summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d142b44)
raw | patch | inline | side by side (parent: d142b44)
author | jaspervdg <jaspervdg@users.sourceforge.net> | |
Sat, 9 Aug 2008 15:50:54 +0000 (15:50 +0000) | ||
committer | jaspervdg <jaspervdg@users.sourceforge.net> | |
Sat, 9 Aug 2008 15:50:54 +0000 (15:50 +0000) |
src/svg/svg-color-test.h | patch | blob | history |
index 0636fa32f7feaddcf187b229eac238f0c655aefa..dbefa1af5a485e40d7357898758f91f4bb899dd9 100644 (file)
--- a/src/svg/svg-color-test.h
+++ b/src/svg/svg-color-test.h
#include <cassert>
#include <cstdlib>
+#include "prefs-utils.h"
#include "svg/svg-color.h"
#include "svg/svg-icc-color.h"
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);
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<n; i++) {
+ gchar const* end = 0;
+ guint32 result = sp_svg_read_color( val[i], &end, 0x3 );
+ TS_ASSERT_EQUALS( result, 0xff00ff00 );
+ TS_ASSERT_LESS_THAN( val[i], end );
+ }
}
void testIccColor()