Code

Filter effects dialog:
[inkscape.git] / src / attributes-test.h
index 1e413c90f4245229d9a5d065b0784b6ed662ae8c..1030f9e46755ca94599b8ed2418ff862d54674de 100644 (file)
@@ -5,6 +5,8 @@
 #include <cxxtest/TestSuite.h>
 
 #include <vector>
+#include <glib.h>
+#include <glib/gprintf.h>
 #include "utest/utest.h"
 #include "attributes.h"
 #include "streq.h"
@@ -50,17 +52,17 @@ struct {char const *attr; bool supported;} const all_attrs[] = {
     {"accumulate", true},
     {"alignment-baseline", true},
     {"alphabetic", false},
-    {"amplitude", false},
+    {"amplitude", true},
     {"animate", false},
     {"arabic-form", false},
     {"ascent", false},
     {"attributeType", true},
     {"azimuth", false},
-    {"baseFrequency", false},
+    {"baseFrequency", true},
     {"baseline-shift", true},
     {"baseProfile", false},
     {"bbox", false},
-    {"bias", false},
+    {"bias", true},
     {"block-progression", true},
     {"by", true},
     {"calcMode", true},
@@ -82,19 +84,19 @@ struct {char const *attr; bool supported;} const all_attrs[] = {
     {"cy", true},
     {"d", true},
     {"descent", false},
-    {"diffuseConstant", false},
+    {"diffuseConstant", true},
     {"direction", true},
     {"display", true},
-    {"divisor", false},
+    {"divisor", true},
     {"dominant-baseline", true},
     {"dur", true},
     {"dx", true},
     {"dy", true},
-    {"edgeMode", false},
+    {"edgeMode", true},
     {"elevation", false},
     {"enable-background", true},
     {"end", true},
-    {"exponent", false},
+    {"exponent", true},
     {"externalResourcesRequired", false},
     {"feBlend", false},
     {"feColorMatrix", false},
@@ -146,15 +148,15 @@ struct {char const *attr; bool supported;} const all_attrs[] = {
     {"ideographic", false},
     {"image-rendering", true},
     {"in", false},
-    {"in2", false},
-    {"intercept", false},
+    {"in2", true},
+    {"intercept", true},
     {"k", false},
-    {"k1", false},
-    {"k2", false},
-    {"k3", false},
-    {"k4", false},
-    {"kernelMatrix", false},
-    {"kernelUnitLength", false},
+    {"k1", true},
+    {"k2", true},
+    {"k3", true},
+    {"k4", true},
+    {"kernelMatrix", true},
+    {"kernelUnitLength", true},
     {"kerning", true},
     {"keyPoints", false},
     {"keySplines", true},
@@ -179,9 +181,9 @@ struct {char const *attr; bool supported;} const all_attrs[] = {
     {"media", false},
     {"method", false},
     {"min", true},
-    {"mode", false},
+    {"mode", true},
     {"name", true},
-    {"numOctaves", false},
+    {"numOctaves", true},
     {"offset", true},
     {"onabort", false},
     {"onactivate", false},
@@ -203,8 +205,8 @@ struct {char const *attr; bool supported;} const all_attrs[] = {
     {"onunload", false},
     {"onzoom", false},
     {"opacity", true},
-    {"operator", false},
-    {"order", false},
+    {"operator", true},
+    {"order", true},
     {"orient", true},
     {"orientation", true},
     {"origin", false},
@@ -222,11 +224,11 @@ struct {char const *attr; bool supported;} const all_attrs[] = {
     {"pointsAtX", false},
     {"pointsAtY", false},
     {"pointsAtZ", false},
-    {"preserveAlpha", false},
+    {"preserveAlpha", true},
     {"preserveAspectRatio", true},
     {"primitiveUnits", true},
     {"r", true},
-    {"radius", false},
+    {"radius", true},
     {"refX", true},
     {"refY", true},
     {"rendering-intent", true},
@@ -239,19 +241,19 @@ struct {char const *attr; bool supported;} const all_attrs[] = {
     {"rotate", true},
     {"rx", true},
     {"ry", true},
-    {"scale", false},
-    {"seed", false},
+    {"scale", true},
+    {"seed", true},
     {"shape-rendering", true},
-    {"slope", false},
+    {"slope", true},
     {"spacing", false},
-    {"specularConstant", false},
-    {"specularExponent", false},
+    {"specularConstant", true},
+    {"specularExponent", true},
     {"spreadMethod", true},
     {"startOffset", true},
     {"stdDeviation", true},
     {"stemh", false},
     {"stemv", false},
-    {"stitchTiles", false},
+    {"stitchTiles", true},
     {"stop-color", true},
     {"stop-opacity", true},
     {"strikethrough-position", false},
@@ -265,12 +267,12 @@ struct {char const *attr; bool supported;} const all_attrs[] = {
     {"stroke-opacity", true},
     {"stroke-width", true},
     {"style", true},
-    {"surfaceScale", false},
+    {"surfaceScale", true},
     {"systemLanguage", true},
-    {"tableValues", false},
+    {"tableValues", true},
     {"target", true},
-    {"targetX", false},
-    {"targetY", false},
+    {"targetX", true},
+    {"targetY", true},
     {"text-align", true},
     {"text-anchor", true},
     {"text-decoration", true},
@@ -310,7 +312,7 @@ struct {char const *attr; bool supported;} const all_attrs[] = {
     {"x-height", false},
     {"x1", true},
     {"x2", true},
-    {"xChannelSelector", false},
+    {"xChannelSelector", true},
     {"xlink:actuate", true},
     {"xlink:arcrole", true},
     {"xlink:href", true},
@@ -325,7 +327,7 @@ struct {char const *attr; bool supported;} const all_attrs[] = {
     {"y", true},
     {"y1", true},
     {"y2", true},
-    {"yChannelSelector", false},
+    {"yChannelSelector", true},
     {"z", false},
     {"zoomAndPan", false},
 
@@ -339,8 +341,8 @@ struct {char const *attr; bool supported;} const all_attrs[] = {
     {"inkscape:groupmode", true},
     {"sodipodi:version", true},
     {"inkscape:version", true},
-    {"inkscape:object-bbox", true},
-    {"inkscape:object-points", true},
+/*  {"inkscape:object-bbox", true},
+    {"inkscape:object-points", true},*/
     {"inkscape:object-paths", true},
     {"inkscape:object-nodes", true},
     {"inkscape:pageopacity", true},
@@ -354,10 +356,10 @@ struct {char const *attr; bool supported;} const all_attrs[] = {
     {"inkscape:window-height", true},
     {"inkscape:window-x", true},
     {"inkscape:window-y", true},
-    {"inkscape:grid-bbox", true},
+/*  {"inkscape:grid-bbox", true},
     {"inkscape:guide-bbox", true},
     {"inkscape:grid-points", true},
-    {"inkscape:guide-points", true},
+    {"inkscape:guide-points", true},*/
     {"inkscape:current-layer", true},
     {"inkscape:connector-type", true},
     {"inkscape:connection-start", true},
@@ -407,7 +409,6 @@ struct {char const *attr; bool supported;} const all_attrs[] = {
     {"gridtolerance", true},
     {"guidetolerance", true},
     {"objecttolerance", true},
-    {"has_abs_tolerance", true},
     {"gridoriginx", true},
     {"gridoriginy", true},
     {"gridspacingx", true},
@@ -486,11 +487,20 @@ struct {char const *attr; bool supported;} const all_attrs[] = {
         unsigned const n_ids = ids.size();
         for (unsigned id = 1; id < n_ids; ++id) {
             if (!ids[id]) {
-               TS_WARN( std::string((const char*)sp_attribute_name(id)) );
+                gchar* tmp = g_strdup_printf( "Attribute string with enum %d {%s} not handled", id, sp_attribute_name(id) );
+                TS_WARN( std::string((const char*)tmp) );
+                g_free( tmp );
                 found = true;
             }
         }
         TS_ASSERT(!found);
+
+        for ( guint index = 1; index < n_ids; index++ ) {
+            guchar const* name = sp_attribute_name(index);
+            gint postLookup = sp_attribute_lookup( reinterpret_cast<gchar const*>(name) );
+            TSM_ASSERT_EQUALS( std::string("Enum round-trip through string {") + (char const*)name + "} failed.", index, postLookup );
+        }
+
     }
 };