Code

replace text strings by ints for tools/bounding_box
[inkscape.git] / src / attributes-test.h
index 9117bec4ce2a8dd9c434f5643b07efde7da0741b..b5c05e988fb4483235b6c8e8b2ac3edaa53ed9e4 100644 (file)
@@ -1,7 +1,12 @@
 
+#ifndef SEEN_ATTRIBUTES_TEST_H
+#define SEEN_ATTRIBUTES_TEST_H
+
 #include <cxxtest/TestSuite.h>
 
 #include <vector>
+#include <glib.h>
+#include <glib/gprintf.h>
 #include "utest/utest.h"
 #include "attributes.h"
 #include "streq.h"
@@ -47,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},
+    {"azimuth", true},
+    {"baseFrequency", true},
     {"baseline-shift", true},
     {"baseProfile", false},
     {"bbox", false},
-    {"bias", false},
+    {"bias", true},
     {"block-progression", true},
     {"by", true},
     {"calcMode", true},
@@ -79,31 +84,41 @@ 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},
-    {"elevation", false},
+    {"edgeMode", true},
+    {"elevation", true},
     {"enable-background", true},
     {"end", true},
-    {"exponent", false},
+    {"exponent", true},
     {"externalResourcesRequired", false},
+    {"feBlend", false},
     {"feColorMatrix", false},
+    {"feComponentTransfer", false},
     {"feComposite", false},
+    {"feConvolveMatrix", false},
+    {"feDiffuseLighting", false},
+    {"feDisplacementMap", false},
+    {"feFlood", false},
     {"feGaussianBlur", false},
+    {"feImage", false},
+    {"feMerge", false},
     {"feMorphology", false},
+    {"feOffset", false},
+    {"feSpecularLighting", false},
     {"feTile", false},
     {"fill", true},
     {"fill-opacity", true},
     {"fill-rule", true},
     {"filter", true},
-    {"filterRes", false},
-    {"filterUnits", false},
+    {"filterRes", true},
+    {"filterUnits", true},
     {"flood-color", true},
     {"flood-opacity", true},
     {"font-family", true},
@@ -132,16 +147,16 @@ struct {char const *attr; bool supported;} const all_attrs[] = {
     {"horiz-origin-y", false},
     {"ideographic", false},
     {"image-rendering", true},
-    {"in", false},
-    {"in2", false},
-    {"intercept", false},
+    {"in", true},
+    {"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},
@@ -150,7 +165,7 @@ struct {char const *attr; bool supported;} const all_attrs[] = {
     {"lengthAdjust", false},
     {"letter-spacing", true},
     {"lighting-color", true},
-    {"limitingConeAngle", false},
+    {"limitingConeAngle", true},
     {"local", true},
     {"marker-end", true},
     {"marker-mid", true},
@@ -166,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},
@@ -190,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},
@@ -206,38 +221,39 @@ struct {char const *attr; bool supported;} const all_attrs[] = {
     {"patternUnits", true},
     {"pointer-events", true},
     {"points", true},
-    {"pointsAtX", false},
-    {"pointsAtY", false},
-    {"pointsAtZ", false},
-    {"preserveAlpha", false},
+    {"pointsAtX", true},
+    {"pointsAtY", true},
+    {"pointsAtZ", true},
+    {"preserveAlpha", true},
     {"preserveAspectRatio", true},
-    {"primitiveUnits", false},
+    {"primitiveUnits", true},
     {"r", true},
-    {"radius", false},
+    {"radius", true},
     {"refX", true},
     {"refY", true},
     {"rendering-intent", true},
     {"repeatCount", true},
     {"repeatDur", true},
-    {"requiredExtensions", false},
+    {"requiredFeatures", true},
+    {"requiredExtensions", true},
     {"restart", true},
-    {"result", false},
+    {"result", true},
     {"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", false},
+    {"stdDeviation", true},
     {"stemh", false},
     {"stemv", false},
-    {"stitchTiles", false},
+    {"stitchTiles", true},
     {"stop-color", true},
     {"stop-opacity", true},
     {"strikethrough-position", false},
@@ -251,12 +267,12 @@ struct {char const *attr; bool supported;} const all_attrs[] = {
     {"stroke-opacity", true},
     {"stroke-width", true},
     {"style", true},
-    {"surfaceScale", false},
-    {"systemLanguage", false},
-    {"tableValues", false},
+    {"surfaceScale", true},
+    {"systemLanguage", true},
+    {"tableValues", true},
     {"target", true},
-    {"targetX", false},
-    {"targetY", false},
+    {"targetX", true},
+    {"targetY", true},
     {"text-align", true},
     {"text-anchor", true},
     {"text-decoration", true},
@@ -296,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},
@@ -311,8 +327,8 @@ struct {char const *attr; bool supported;} const all_attrs[] = {
     {"y", true},
     {"y1", true},
     {"y2", true},
-    {"yChannelSelector", false},
-    {"z", false},
+    {"yChannelSelector", true},
+    {"z", true},
     {"zoomAndPan", false},
 
     /* Extra attributes. */
@@ -325,10 +341,18 @@ 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-paths", true},
     {"inkscape:object-nodes", true},
+    {"inkscape:bbox-paths", true},
+    {"inkscape:bbox-nodes", true},
+    {"inkscape:snap-page", true},
+    {"inkscape:snap-global", true},
+    {"inkscape:snap-bbox", true},
+    {"inkscape:snap-nodes", true},
+    {"inkscape:snap-guide", true},
+    {"inkscape:snap-center", true},
+    {"inkscape:snap-intersection-grid-guide", true},
+    {"inkscape:snap-intersection-line-segments", true},
     {"inkscape:pageopacity", true},
     {"inkscape:pageshadow", true},
     {"inkscape:transform-center-x", true},
@@ -340,10 +364,6 @@ 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:guide-bbox", true},
-    {"inkscape:grid-points", true},
-    {"inkscape:guide-points", true},
     {"inkscape:current-layer", true},
     {"inkscape:connector-type", true},
     {"inkscape:connection-start", true},
@@ -354,6 +374,15 @@ struct {char const *attr; bool supported;} const all_attrs[] = {
     {"sodipodi:cy", true},
     {"sodipodi:rx", true},
     {"sodipodi:ry", true},
+    {"inkscape:perspectiveID", true},
+    {"inkscape:corner0", true},
+    {"inkscape:corner7", true},
+    {"inkscape:box3dsidetype", true},
+    {"inkscape:persp3d", true},
+    {"inkscape:vp_x", true},
+    {"inkscape:vp_y", true},
+    {"inkscape:vp_z", true},
+    {"inkscape:persp3d-origin", true},
     {"sodipodi:start", true},
     {"sodipodi:end", true},
     {"sodipodi:open", true},
@@ -388,20 +417,22 @@ struct {char const *attr; bool supported;} const all_attrs[] = {
     /* SPNamedView */
     {"viewonly", true},
     {"showgrid", true},
+//    {"gridtype", true},
     {"showguides", true},
     {"gridtolerance", true},
     {"guidetolerance", true},
     {"objecttolerance", true},
-    {"has_abs_tolerance", true},
-    {"gridoriginx", true},
+/*    {"gridoriginx", true},
     {"gridoriginy", true},
     {"gridspacingx", true},
     {"gridspacingy", true},
+    {"gridanglex", true},
+    {"gridanglez", true},
     {"gridcolor", true},
     {"gridopacity", true},
     {"gridempcolor", true},
     {"gridempopacity", true},
-    {"gridempspacing", true},
+    {"gridempspacing", true}, */
     {"guidecolor", true},
     {"guideopacity", true},
     {"guidehicolor", true},
@@ -469,14 +500,25 @@ 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 );
+        }
+
     }
 };
 
+#endif // SEEN_ATTRIBUTES_TEST_H
+
 /*
   Local Variables:
   mode:c++