summaryrefslogtreecommitdiffstats
path: root/test/textbox-test.c
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2016-10-20 09:41:32 +0200
committerDave Davenport <qball@gmpclient.org>2016-10-20 09:41:32 +0200
commit881056ea9b1a606d1d979be631795a3a07d5621e (patch)
treef795dd690a922b7ec851ebff3ce1ac1d0a2d9d7d /test/textbox-test.c
parentd0d186960454135b8080123404302c741facfd4b (diff)
Add some more tests, make some textbox api's private
Diffstat (limited to 'test/textbox-test.c')
-rw-r--r--test/textbox-test.c43
1 files changed, 35 insertions, 8 deletions
diff --git a/test/textbox-test.c b/test/textbox-test.c
index 5383e8e9..fc5209ca 100644
--- a/test/textbox-test.c
+++ b/test/textbox-test.c
@@ -57,7 +57,7 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
NORMAL, "test" );
TASSERT ( box != NULL );
- textbox_cursor_end ( box );
+ textbox_keybinding ( box, MOVE_END );
TASSERT ( box->cursor == 4 );
textbox_cursor ( box, -1 );
TASSERT ( box->cursor == 0 );
@@ -67,7 +67,7 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
TASSERT ( box->cursor == 2 );
textbox_insert ( box, 3, "bo", 2 );
TASSERT ( strcmp ( box->text, "tesbot" ) == 0 );
- textbox_cursor_end ( box );
+ textbox_keybinding ( box, MOVE_END );
TASSERT ( box->cursor == 6 );
TASSERT ( widget_get_width ( WIDGET ( box ) ) > 0 );
@@ -78,19 +78,19 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
TASSERT ( textbox_get_estimated_char_width ( ) > 0 );
- textbox_cursor_bkspc ( box );
+ textbox_keybinding ( box, REMOVE_CHAR_BACK );
TASSERT ( strcmp ( box->text, "tesbo" ) == 0 );
TASSERT ( box->cursor == 5 );
- textbox_cursor_dec ( box );
+ textbox_keybinding ( box, MOVE_CHAR_BACK );
TASSERT ( box->cursor == 4 );
- textbox_cursor_del ( box );
+ textbox_keybinding ( box, REMOVE_CHAR_FORWARD );
TASSERT ( strcmp ( box->text, "tesb" ) == 0 );
- textbox_cursor_dec ( box );
+ textbox_keybinding ( box, MOVE_CHAR_BACK );
TASSERT ( box->cursor == 3 );
- textbox_cursor_inc ( box );
+ textbox_keybinding ( box, MOVE_CHAR_FORWARD);
TASSERT ( box->cursor == 4 );
- textbox_cursor_inc ( box );
+ textbox_keybinding ( box, MOVE_CHAR_FORWARD);
TASSERT ( box->cursor == 4 );
// Cursor after delete section.
textbox_delete ( box, 0, 1 );
@@ -122,6 +122,33 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
TASSERT ( strcmp ( box->text, "aapmies" ) == 0 );
TASSERT ( box->cursor == 5 );
+
+ textbox_text ( box, "aap noot mies");
+ textbox_cursor ( box, 8 );
+ textbox_keybinding ( box, REMOVE_WORD_BACK );
+ TASSERT ( box->cursor == 4);
+ TASSERT ( strcmp ( box->text, "aap mies") == 0 );
+ textbox_keybinding ( box, REMOVE_TO_EOL );
+ TASSERT ( box->cursor == 4);
+ TASSERT ( strcmp ( box->text, "aap ") == 0 );
+ textbox_text ( box, "aap noot mies");
+ textbox_cursor ( box, 8 );
+ textbox_keybinding ( box, REMOVE_WORD_FORWARD );
+ TASSERT ( strcmp ( box->text, "aap noot") == 0 );
+ textbox_keybinding ( box, MOVE_FRONT );
+ TASSERT ( box->cursor == 0);
+ textbox_keybinding ( box, CLEAR_LINE );
+ TASSERT ( strcmp ( box->text, "") == 0 );
+ textbox_text ( box, "aap noot mies");
+ textbox_keybinding ( box, MOVE_END);
+ textbox_keybinding ( box, MOVE_WORD_BACK );
+ TASSERT ( box->cursor == 9);
+ textbox_keybinding ( box, MOVE_WORD_BACK );
+ TASSERT ( box->cursor == 4);
+ textbox_keybinding ( box, REMOVE_TO_SOL );
+ TASSERT ( strcmp ( box->text, "noot mies") == 0 );
+ TASSERT ( box->cursor == 0);
+
textbox_font ( box, HIGHLIGHT );
//textbox_draw ( box, draw );