summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2016-10-25 21:19:39 +0200
committerDave Davenport <qball@gmpclient.org>2016-10-25 21:19:39 +0200
commita38ac9caf3c17d1f92cbc8696c39644d6a74241f (patch)
tree320178ee139f531f1d8325e5c1ef4341ceacf5ba /test
parent8a186726f8fa8f2015c1faa9db0d34fe2eb13cfd (diff)
Update scrollbar behaviour, so dragging is more natural. (limit range from hw/2 to h-hw/2)
Diffstat (limited to 'test')
-rw-r--r--test/helper-test.c36
-rw-r--r--test/scrollbar-test.c14
-rw-r--r--test/textbox-test.c35
3 files changed, 42 insertions, 43 deletions
diff --git a/test/helper-test.c b/test/helper-test.c
index 4ed00128..ad88a0cf 100644
--- a/test/helper-test.c
+++ b/test/helper-test.c
@@ -82,36 +82,36 @@ int main ( int argc, char ** argv )
* Quick converision check.
*/
{
- char *str = rofi_latin_to_utf8_strdup ( "\xA1\xB5", 2);
- TASSERT ( g_utf8_collate ( str, "¡µ") == 0 );
- g_free(str);
+ char *str = rofi_latin_to_utf8_strdup ( "\xA1\xB5", 2 );
+ TASSERT ( g_utf8_collate ( str, "¡µ" ) == 0 );
+ g_free ( str );
}
-
+
{
- char *str = rofi_force_utf8("Valid utf8", 10);
- TASSERT ( g_utf8_collate ( str, "Valid utf8") == 0 );
- g_free(str);
+ char *str = rofi_force_utf8 ( "Valid utf8", 10 );
+ TASSERT ( g_utf8_collate ( str, "Valid utf8" ) == 0 );
+ g_free ( str );
char in[] = "Valid utf8 until \xc3\x28 we continue here";
TASSERT ( g_utf8_validate ( in, -1, NULL ) == FALSE );
- str = rofi_force_utf8(in, strlen(in));
+ str = rofi_force_utf8 ( in, strlen ( in ) );
TASSERT ( g_utf8_validate ( str, -1, NULL ) == TRUE );
- TASSERT ( g_utf8_collate ( str, "Valid utf8 until �( we continue here") == 0 );
- g_free(str);
- }
+ TASSERT ( g_utf8_collate ( str, "Valid utf8 until �( we continue here" ) == 0 );
+ g_free ( str );
+ }
// Pid test.
// Tests basic functionality of writing it, locking, seeing if I can write same again
// And close/reopen it again.
{
- const char *path = "/tmp/rofi-test.pid";
- TASSERT( create_pid_file ( NULL ) == -1 );
- int fd = create_pid_file ( path );
- TASSERT( fd >= 0 );
- int fd2 = create_pid_file ( path );
- TASSERT ( fd2 < 0 );
+ const char *path = "/tmp/rofi-test.pid";
+ TASSERT ( create_pid_file ( NULL ) == -1 );
+ int fd = create_pid_file ( path );
+ TASSERT ( fd >= 0 );
+ int fd2 = create_pid_file ( path );
+ TASSERT ( fd2 < 0 );
remove_pid_file ( fd );
fd = create_pid_file ( path );
- TASSERT( fd >= 0 );
+ TASSERT ( fd >= 0 );
remove_pid_file ( fd );
}
}
diff --git a/test/scrollbar-test.c b/test/scrollbar-test.c
index 9511de63..ebdbeac3 100644
--- a/test/scrollbar-test.c
+++ b/test/scrollbar-test.c
@@ -52,24 +52,24 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
TASSERTE ( sb->pos_length, 1 );
unsigned int cl = scrollbar_clicked ( sb, 10 );
- TASSERTE ( cl, 1000);
+ TASSERTE ( cl, 900);
cl = scrollbar_clicked ( sb, 20 );
- TASSERTE ( cl, 2000);
+ TASSERTE ( cl, 1900);
cl = scrollbar_clicked ( sb, 0 );
TASSERTE ( cl, 0);
cl = scrollbar_clicked ( sb, 99 );
- TASSERTE ( cl, 9900);
+ TASSERTE ( cl, 9800);
scrollbar_set_max_value ( sb, 100 );
- for ( unsigned int i = 0; i < 100; i++ ){
+ for ( unsigned int i = 1; i < 99; i++ ){
cl = scrollbar_clicked ( sb, i );
- TASSERTE ( cl, i);
+ TASSERTE ( cl, i-1);
}
scrollbar_set_max_value ( sb, 200 );
- for ( unsigned int i = 0; i < 100; i++ ){
+ for ( unsigned int i = 1; i < 100; i++ ){
cl = scrollbar_clicked ( sb, i );
- TASSERTE ( cl, i*2);
+ TASSERTE ( cl, i*2-2);
}
widget_free( WIDGET (sb ) );
}
diff --git a/test/textbox-test.c b/test/textbox-test.c
index fc5209ca..3fa33344 100644
--- a/test/textbox-test.c
+++ b/test/textbox-test.c
@@ -88,9 +88,9 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
TASSERT ( strcmp ( box->text, "tesb" ) == 0 );
textbox_keybinding ( box, MOVE_CHAR_BACK );
TASSERT ( box->cursor == 3 );
- textbox_keybinding ( box, MOVE_CHAR_FORWARD);
+ textbox_keybinding ( box, MOVE_CHAR_FORWARD );
TASSERT ( box->cursor == 4 );
- textbox_keybinding ( box, MOVE_CHAR_FORWARD);
+ textbox_keybinding ( box, MOVE_CHAR_FORWARD );
TASSERT ( box->cursor == 4 );
// Cursor after delete section.
textbox_delete ( box, 0, 1 );
@@ -122,32 +122,31 @@ 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_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 );
+ 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");
+ 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 );
+ TASSERT ( strcmp ( box->text, "aap noot" ) == 0 );
textbox_keybinding ( box, MOVE_FRONT );
- TASSERT ( box->cursor == 0);
+ 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);
+ 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);
+ TASSERT ( box->cursor == 9 );
textbox_keybinding ( box, MOVE_WORD_BACK );
- TASSERT ( box->cursor == 4);
+ TASSERT ( box->cursor == 4 );
textbox_keybinding ( box, REMOVE_TO_SOL );
- TASSERT ( strcmp ( box->text, "noot mies") == 0 );
- TASSERT ( box->cursor == 0);
+ TASSERT ( strcmp ( box->text, "noot mies" ) == 0 );
+ TASSERT ( box->cursor == 0 );
textbox_font ( box, HIGHLIGHT );
//textbox_draw ( box, draw );