summaryrefslogtreecommitdiffstats
path: root/test/helper-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/helper-test.c
parentd0d186960454135b8080123404302c741facfd4b (diff)
Add some more tests, make some textbox api's private
Diffstat (limited to 'test/helper-test.c')
-rw-r--r--test/helper-test.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/helper-test.c b/test/helper-test.c
index 9d70c61a..4ae5694a 100644
--- a/test/helper-test.c
+++ b/test/helper-test.c
@@ -78,4 +78,24 @@ int main ( int argc, char ** argv )
TASSERTE ( levenshtein ( "aap", "noot aap mies" ), 10 );
TASSERTE ( levenshtein ( "noot aap mies", "aap" ), 10 );
TASSERTE ( levenshtein ( "otp", "noot aap" ), 5 );
+ /**
+ * 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_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));
+ TASSERT ( g_utf8_validate ( str, -1, NULL ) == TRUE );
+ TASSERT ( g_utf8_collate ( str, "Valid utf8 until �( we continue here") == 0 );
+ g_free(str);
+ }
}