From: jaspervdg Date: Sat, 9 Aug 2008 15:50:54 +0000 (+0000) Subject: A few more tests for svg-color X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=a9dc6f3f0b1112d205d68c867c4a2b006c19f52f;p=inkscape.git A few more tests for svg-color --- diff --git a/src/svg/svg-color-test.h b/src/svg/svg-color-test.h index 0636fa32f..dbefa1af5 100644 --- a/src/svg/svg-color-test.h +++ b/src/svg/svg-color-test.h @@ -2,6 +2,7 @@ #include #include +#include "prefs-utils.h" #include "svg/svg-color.h" #include "svg/svg-icc-color.h" @@ -18,6 +19,11 @@ public: void check_rgb24(unsigned const rgb24) { char css[8]; + prefs_set_int_attribute("options.svgoutput", "usenamedcolors", 0); + sp_svg_write_color(css, sizeof(css), rgb24 << 8); + TS_ASSERT_EQUALS(sp_svg_read_color(css, 0xff), + rgb24 << 8); + prefs_set_int_attribute("options.svgoutput", "usenamedcolors", 1); sp_svg_write_color(css, sizeof(css), rgb24 << 8); TS_ASSERT_EQUALS(sp_svg_read_color(css, 0xff), rgb24 << 8); @@ -54,11 +60,14 @@ public: void testReadColor() { - gchar const* val="#f0f"; - gchar const* end = 0; - guint32 result = sp_svg_read_color( val, &end, 0x3 ); - TS_ASSERT_EQUALS( result, 0xff00ff00 ); - TS_ASSERT_LESS_THAN( val, end ); + gchar const* val[] = {"#f0f", "#ff00ff", "rgb(255,0,255)", "fuchsia"}; + size_t const n = sizeof(val)/sizeof(*val); + for(size_t i=0; i