summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMatthias Melcher <github@matthiasm.com>2022-11-08 23:55:33 +0100
committerMatthias Melcher <github@matthiasm.com>2022-11-08 23:55:33 +0100
commite6c3cae6f255a6ec516609bdad767399ab135b6c (patch)
tree366f5cb8bfca2f2f9a85c4552f88be3d475359d2 /test
parentb76152cf6c0346a34a1f866ad1809ad0c6f2e6ea (diff)
Testing emojis in test/utf8.
Diffstat (limited to 'test')
-rw-r--r--test/utf8.cxx16
1 files changed, 11 insertions, 5 deletions
diff --git a/test/utf8.cxx b/test/utf8.cxx
index ce5cd9378..f77245597 100644
--- a/test/utf8.cxx
+++ b/test/utf8.cxx
@@ -566,12 +566,19 @@ public:
int main(int argc, char** argv)
{
- const char *latin1 = // "ABCabcàèéïâîöüã123"
- "\x41\x42\x43\x61\x62\x63\xe0\xe8\xe9\xef\xe2\xee\xf6\xfc\xe3\x31\x32\x33";
-
- char *utf8 = (char*) malloc(strlen(latin1) * 5 + 1);
+ const char *latin1 = // "ABCabcàèéïßîöüã123"
+ "\x41\x42\x43\x61\x62\x63\xe0\xe8\xe9\xef\xdf\xee\xf6\xfc\xe3\x31\x32\x33";
+ const char *emoji = // grinning face with smiling eyes, thumbs up
+ "\360\237\230\204\360\237\221\215end";
+ // NOTE: FLTK does not currently support modifiers like skin tones
+ // or ZWJs (zero width joiners)
+ char *utf8 = (char*) malloc((strlen(latin1)+4) * 5 + 1);
int l = fl_utf8froma(utf8, (unsigned int)strlen(latin1) * 5 + 1,
latin1, (unsigned int)strlen(latin1));
+ utf8[l] = '\0';
+ strcat(utf8, emoji);
+ l = strlen(utf8);
+
make_font_chooser();
extra_font = FL_TIMES_BOLD_ITALIC;
@@ -590,7 +597,6 @@ int main(int argc, char** argv)
main_win->begin();
Fl_Input i1(5, 5, 190, 25);
- utf8[l] = '\0';
i1.value(utf8);
Fl_Scroll scroll(200,0,5 * 75,400);