summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMatthias Melcher <github@matthiasm.com>2023-02-25 22:44:39 +0100
committerGitHub <noreply@github.com>2023-02-25 22:44:39 +0100
commit13cd927ab43c2ac27d4c5491366ae9d28da23710 (patch)
tree74512edfddd03209abb620caa3bc79aaad479341 /test
parent314ad2310e677b0826b21677afbbf2dfac675f37 (diff)
Add Fl_String to Fl_Preferences (#687)
Diffstat (limited to 'test')
-rw-r--r--test/unittest_core.cxx23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/unittest_core.cxx b/test/unittest_core.cxx
index 7e6699956..30def3782 100644
--- a/test/unittest_core.cxx
+++ b/test/unittest_core.cxx
@@ -193,6 +193,29 @@ TEST(Fl_String, Non-Member Functions) {
return true;
}
+/* Test additions to Fl_Preferences. */
+TEST(Fl_Preferences, Strings) {
+ {
+ Fl_Preferences prefs(Fl_Preferences::USER_L, "fltk.org", "unittests");
+ prefs.set("a", Fl_String());
+ prefs.set("b", Fl_String("Hello"));
+ prefs.set("c", Fl_String("Hel\\l\nö"));
+ }
+ {
+ Fl_Preferences prefs(Fl_Preferences::USER_L, "fltk.org", "unittests");
+ Fl_String r;
+ prefs.get("a", r, "x");
+ EXPECT_STREQ(r.c_str(), "");
+ prefs.get("b", r, "x");
+ EXPECT_STREQ(r.c_str(), "Hello");
+ prefs.get("c", r, "x");
+ EXPECT_STREQ(r.c_str(), "Hel\\l\nö");
+ prefs.get("d", r, "x");
+ EXPECT_STREQ(r.c_str(), "x");
+ }
+ return true;
+}
+
//
//------- test aspects of the FLTK core library ----------
//