summaryrefslogtreecommitdiffstats
path: root/testfiles/src
diff options
context:
space:
mode:
Diffstat (limited to 'testfiles/src')
-rw-r--r--testfiles/src/cxxtests-to-migrate/extract-uri-test.h88
-rw-r--r--testfiles/src/cxxtests-to-migrate/marker-test.h39
-rw-r--r--testfiles/src/cxxtests-to-migrate/mod360-test.h56
-rw-r--r--testfiles/src/cxxtests-to-migrate/object-test.h234
-rw-r--r--testfiles/src/cxxtests-to-migrate/preferences-test.h136
-rw-r--r--testfiles/src/cxxtests-to-migrate/round-test.h91
-rw-r--r--testfiles/src/cxxtests-to-migrate/sp-gradient-test.h161
-rw-r--r--testfiles/src/cxxtests-to-migrate/sp-style-elem-test.h166
-rw-r--r--testfiles/src/cxxtests-to-migrate/style-test.h537
-rw-r--r--testfiles/src/cxxtests-to-migrate/test-helpers.h66
-rw-r--r--testfiles/src/cxxtests-to-migrate/uri-test.h90
-rw-r--r--testfiles/src/cxxtests-to-migrate/verbs-test.h86
12 files changed, 1750 insertions, 0 deletions
diff --git a/testfiles/src/cxxtests-to-migrate/extract-uri-test.h b/testfiles/src/cxxtests-to-migrate/extract-uri-test.h
new file mode 100644
index 000000000..e795960a9
--- /dev/null
+++ b/testfiles/src/cxxtests-to-migrate/extract-uri-test.h
@@ -0,0 +1,88 @@
+
+#ifndef SEEN_EXTRACT_URI_TEST_H
+#define SEEN_EXTRACT_URI_TEST_H
+
+#include <cxxtest/TestSuite.h>
+
+#include "extract-uri.h"
+
+class ExtractURITest : public CxxTest::TestSuite
+{
+public:
+ void checkOne( char const* str, char const* expected )
+ {
+ gchar* result = extract_uri( str );
+ TS_ASSERT_EQUALS( ( result == NULL ), ( expected == NULL ) );
+ if ( result && expected ) {
+ TS_ASSERT_EQUALS( std::string(result), std::string(expected) );
+ } else if ( result ) {
+ TS_FAIL( std::string("Expected null, found (") + result + ")" );
+ } else if ( expected ) {
+ TS_FAIL( std::string("Expected (") + expected + "), found null" );
+ }
+ g_free( result );
+ }
+
+ void testBase()
+ {
+ char const* cases[][2] = {
+ { "url(#foo)", "#foo" },
+ { "url foo ", NULL },
+ { "url", NULL },
+ { "url ", NULL },
+ { "url()", NULL },
+ { "url ( ) ", NULL },
+ { "url foo bar ", NULL },
+ };
+
+ for ( size_t i = 0; i < G_N_ELEMENTS(cases); i++ )
+ {
+ checkOne( cases[i][0], cases[i][1] );
+ }
+ }
+
+ void testWithTrailing()
+ {
+ char const* cases[][2] = {
+ { "url(#foo) bar", "#foo" },
+ { "url() bar", NULL },
+ { "url ( ) bar ", NULL }
+ };
+
+ for ( size_t i = 0; i < G_N_ELEMENTS(cases); i++ )
+ {
+ checkOne( cases[i][0], cases[i][1] );
+ }
+ }
+
+ void testQuoted()
+ {
+ char const* cases[][2] = {
+ { "url('#foo')", "#foo" },
+ { "url(\"#foo\")", "#foo" },
+ { "url('#f o o')", "#f o o" },
+ { "url(\"#f o o\")", "#f o o" },
+ { "url('#fo\"o')", "#fo\"o" },
+ { "url(\"#fo'o\")", "#fo'o" },
+ };
+
+ for ( size_t i = 0; i < G_N_ELEMENTS(cases); i++ )
+ {
+ checkOne( cases[i][0], cases[i][1] );
+ }
+ }
+
+};
+
+#endif // SEEN_EXTRACT_URI_TEST_H
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
diff --git a/testfiles/src/cxxtests-to-migrate/marker-test.h b/testfiles/src/cxxtests-to-migrate/marker-test.h
new file mode 100644
index 000000000..bf7e1040a
--- /dev/null
+++ b/testfiles/src/cxxtests-to-migrate/marker-test.h
@@ -0,0 +1,39 @@
+/** @file
+ * @brief Unit tests for SVG marker handling
+ */
+/* Authors:
+ * Johan Engelen <goejendaagh@zonnet.nl>
+ *
+ * This file is released into the public domain.
+ */
+
+#include <cxxtest/TestSuite.h>
+
+#include "sp-marker-loc.h"
+
+class MarkerTest : public CxxTest::TestSuite
+{
+public:
+
+ void testMarkerLoc()
+ {
+ // code depends on these *exact* values, so check them here.
+ TS_ASSERT_EQUALS(SP_MARKER_LOC, 0);
+ TS_ASSERT_EQUALS(SP_MARKER_LOC_START, 1);
+ TS_ASSERT_EQUALS(SP_MARKER_LOC_MID, 2);
+ TS_ASSERT_EQUALS(SP_MARKER_LOC_END, 3);
+ TS_ASSERT_EQUALS(SP_MARKER_LOC_QTY, 4);
+ }
+
+};
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
diff --git a/testfiles/src/cxxtests-to-migrate/mod360-test.h b/testfiles/src/cxxtests-to-migrate/mod360-test.h
new file mode 100644
index 000000000..932361eb3
--- /dev/null
+++ b/testfiles/src/cxxtests-to-migrate/mod360-test.h
@@ -0,0 +1,56 @@
+
+#ifndef SEEN_MOD_360_TEST_H
+#define SEEN_MOD_360_TEST_H
+
+#include <cxxtest/TestSuite.h>
+#include <2geom/math-utils.h>
+#include "mod360.h"
+
+
+class Mod360Test : public CxxTest::TestSuite
+{
+public:
+ static double inf() { return INFINITY; }
+ static double nan() { return ((double)INFINITY) - ((double)INFINITY); }
+
+ void testMod360()
+ {
+ double cases[][2] = {
+ {0, 0},
+ {10, 10},
+ {360, 0},
+ {361, 1},
+ {-1, 359},
+ {-359, 1},
+ {-360, -0},
+ {-361, 359},
+ {inf(), 0},
+ {-inf(), 0},
+ {nan(), 0},
+ {720, 0},
+ {-721, 359},
+ {-1000, 80}
+ };
+
+ for ( unsigned i = 0; i < G_N_ELEMENTS(cases); i++ ) {
+ double result = mod360( cases[i][0] );
+ TS_ASSERT_EQUALS( cases[i][1], result );
+ }
+ }
+
+};
+
+
+#endif // SEEN_MOD_360_TEST_H
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
+
diff --git a/testfiles/src/cxxtests-to-migrate/object-test.h b/testfiles/src/cxxtests-to-migrate/object-test.h
new file mode 100644
index 000000000..0af823684
--- /dev/null
+++ b/testfiles/src/cxxtests-to-migrate/object-test.h
@@ -0,0 +1,234 @@
+#ifndef SEEN_OBJECT_TEST_H
+#define SEEN_OBJECT_TEST_H
+
+#include <cassert>
+#include <ctime>
+#include <cxxtest/TestSuite.h>
+#include <string>
+#include <vector>
+
+#include "document.h"
+#include "sp-item-group.h"
+#include "sp-object.h"
+#include "sp-path.h"
+#include "sp-root.h"
+#include "xml/document.h"
+#include "xml/node.h"
+
+class ObjectTest : public CxxTest::TestSuite
+{
+public:
+ virtual ~ObjectTest() {}
+
+ static ObjectTest *createSuite() { return new ObjectTest(); }
+ static void destroySuite(ObjectTest *suite) { delete suite; }
+
+ void testObjects()
+ {
+ clock_t begin, end;
+ // Sample document
+ // svg:svg
+ // svg:defs
+ // svg:path
+ // svg:linearGradient
+ // svg:stop
+ // svg:filter
+ // svg:feGaussianBlur (feel free to implement for other filters)
+ // svg:clipPath
+ // svg:rect
+ // svg:g
+ // svg:use
+ // svg:circle
+ // svg:ellipse
+ // svg:text
+ // svg:polygon
+ // svg:polyline
+ // svg:image
+ // svg:line
+
+ char const *docString =
+ "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n"
+ "<!-- just a comment -->\n"
+ "<title id=\"title\">SVG test</title>\n"
+ "<defs>\n"
+ " <path id=\"P\" d=\"M -21,-4 -5,0 -18,12 -3,4 -4,21 0,5 12,17 4,2 21,3 5,-1 17,-12 2,-4 3,-21 -1,-5 -12,-18 -4,-3z\"/>\n"
+ " <linearGradient id=\"LG\" x1=\"0%\" y1=\"0%\" x2=\"100%\" y2=\"0%\">\n"
+ " <stop offset=\"0%\" style=\"stop-color:#ffff00;stop-opacity:1\"/>\n"
+ " <stop offset=\"100%\" style=\"stop-color:red;stop-opacity:1\"/>\n"
+ " </linearGradient>\n"
+ " <clipPath id=\"clip\" clipPathUnits=\"userSpaceOnUse\">\n"
+ " <rect x=\"10\" y=\"10\" width=\"100\" height=\"100\"/>\n"
+ " </clipPath>\n"
+ " <filter style=\"color-interpolation-filters:sRGB\" id=\"filter\" x=\"-0.15\" width=\"1.34\" y=\"0\" height=\"1\">\n"
+ " <feGaussianBlur stdDeviation=\"4.26\"/>\n"
+ " </filter>\n"
+ "</defs>\n"
+
+ "<g id=\"G\" transform=\"skewX(10.5) translate(9,5)\">\n"
+ " <use id=\"U\" xlink:href=\"#P\" opacity=\"0.5\" fill=\"#1dace3\" transform=\"rotate(4)\"/>\n"
+ " <circle id=\"C\" cx=\"45.5\" cy=\"67\" r=\"23\" fill=\"#000\"/>\n"
+ " <ellipse id=\"E\" cx=\"200\" cy=\"70\" rx=\"85\" ry=\"55\" fill=\"url(#LG)\"/>\n"
+ " <text id=\"T\" fill=\"#fff\" style=\"font-size:45;font-family:Verdana\" x=\"150\" y=\"86\">TEST</text>\n"
+ " <polygon id=\"PG\" points=\"60,20 100,40 100,80 60,100 20,80 20,40\" clip-path=\"url(#clip)\" filter=\"url(#filter)\"/>\n"
+ " <polyline id=\"PL\" points=\"0,40 40,40 40,80 80,80 80,120 120,120 120,160\" style=\"fill:none;stroke:red;stroke-width:4\"/>\n"
+ " <image id=\"I\" xlink:href=\"data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjE4MCIgd2lkdGg9IjUwMCI+PHBhdGggZD0iTTAsNDAgNDAsNDAgNDAs" // this is one line
+ "ODAgODAsODAgODAsMTIwIDEyMCwxMjAgMTIwLDE2MCIgc3R5bGU9ImZpbGw6d2hpdGU7c3Ryb2tlOnJlZDtzdHJva2Utd2lkdGg6NCIvPjwvc3ZnPgo=\"/>\n"
+ " <line id=\"L\" x1=\"20\" y1=\"100\" x2=\"100\" y2=\"20\" stroke=\"black\" stroke-width=\"2\"/>\n"
+ "</g>\n"
+ "</svg>\n";
+
+ begin = clock();
+ SPDocument *doc = SPDocument::createNewDocFromMem(docString, strlen(docString), false);
+ end = clock();
+
+ assert(doc != NULL); // cannot continue if doc is null, abort!
+ assert(doc->getRoot() != NULL);
+
+ SPRoot *root = doc->getRoot();
+ assert(root->getRepr() != NULL);
+ assert(root->hasChildren());
+
+ std::cout << "Took " << double(end - begin) / double(CLOCKS_PER_SEC) << " seconds to construct the test document\n";
+
+ SPPath *path = dynamic_cast<SPPath *>(doc->getObjectById("P"));
+ testClones(path);
+
+ SPGroup *group = dynamic_cast<SPGroup *>(doc->getObjectById("G"));
+ testGrouping(group);
+
+ // Test parent behavior
+ SPObject *child = root->firstChild();
+ assert(child != NULL);
+ TS_ASSERT(child->parent == root);
+ TS_ASSERT(child->document == doc);
+ TS_ASSERT(root->isAncestorOf(child));
+
+ // Test list behavior
+ SPObject *next = child->getNext();
+ SPObject *prev = next;
+ TS_ASSERT(next->getPrev() == child);
+ prev = next;
+ next = next->getNext();
+ while (next != NULL) {
+ // Walk the list
+ TS_ASSERT(next->getPrev() == prev);
+ prev = next;
+ next = next->getNext();
+ }
+
+ // Test hrefcount
+ TS_ASSERT(path->isReferenced());
+ }
+
+ void testClones(SPPath *path)
+ {
+ clock_t begin, end;
+
+ assert(path != NULL);
+
+ // Since we don't yet have any clean way to do this (FIXME), we'll abuse the XML tree a bit.
+ Inkscape::XML::Node *node = path->getRepr();
+ assert(node != NULL);
+
+ Inkscape::XML::Document *xml_doc = node->document();
+
+ Inkscape::XML::Node *parent = node->parent();
+ assert(parent != NULL);
+
+ TS_TRACE("Benchmarking clones...");
+ const size_t num_clones = 10000;
+
+ std::string href(std::string("#") + std::string(path->getId()));
+ std::vector<Inkscape::XML::Node *> clones(num_clones, NULL);
+
+ begin = clock();
+ // Create num_clones clones of this path and stick them in the document
+ for (size_t i = 0; i < num_clones; ++i) {
+ Inkscape::XML::Node *clone = xml_doc->createElement("svg:use");
+ Inkscape::GC::release(clone);
+ clone->setAttribute("xlink:href", href.c_str());
+ parent->addChild(clone, node);
+ clones[i] = clone;
+ }
+ end = clock();
+
+ std::cout << "Took " << double(end - begin) / double(CLOCKS_PER_SEC) << " seconds to write " << num_clones << " clones of a path\n";
+
+ begin = clock();
+ // Remove those clones
+ for (size_t i = num_clones - 1; i >= 1; --i) {
+ parent->removeChild(clones[i]);
+ }
+ end = clock();
+
+ std::cout << "Took " << double(end - begin) / double(CLOCKS_PER_SEC) << " seconds to remove " << num_clones << " clones of a path\n";
+ }
+
+ void testGrouping(SPGroup *group)
+ {
+ clock_t begin, end;
+
+ assert(group != NULL);
+
+ // Since we don't yet have any clean way to do this (FIXME), we'll abuse the XML tree a bit.
+ Inkscape::XML::Node *node = group->getRepr();
+ assert(node != NULL);
+
+ Inkscape::XML::Document *xml_doc = node->document();
+
+ TS_TRACE("Benchmarking groups...");
+ const size_t num_elements = 10000;
+
+ Inkscape::XML::Node *new_group = xml_doc->createElement("svg:g");
+ Inkscape::GC::release(new_group);
+ node->addChild(new_group, NULL);
+
+ std::vector<Inkscape::XML::Node *> elements(num_elements, NULL);
+
+ begin = clock();
+ for (size_t i = 0; i < num_elements; ++i) {
+ Inkscape::XML::Node *circle = xml_doc->createElement("svg:circle");
+ Inkscape::GC::release(circle);
+ circle->setAttribute("cx", "2048");
+ circle->setAttribute("cy", "1024");
+ circle->setAttribute("r", "1.5");
+ new_group->addChild(circle, NULL);
+ elements[i] = circle;
+ }
+ end = clock();
+
+ std::cout << "Took " << double(end - begin) / double(CLOCKS_PER_SEC) << " seconds to write " << num_elements << " elements into a group\n";
+
+ SPGroup *n_group = dynamic_cast<SPGroup *>(group->get_child_by_repr(new_group));
+ assert(n_group != NULL);
+
+ begin = clock();
+ std::vector<SPItem*> ch;
+ sp_item_group_ungroup(n_group, ch, false);
+ end = clock();
+
+ std::cout << "Took " << double(end - begin) / double(CLOCKS_PER_SEC) << " seconds to ungroup a <g> with " << num_elements << " elements\n";
+ std::cout << " Note: sp_item_group_ungroup_handle_clones() is responsible\n for most of the time as it is linear in number of elements\n which results in quadratic behavior for ungrouping." << std::endl;
+
+ begin = clock();
+ // Remove those elements
+ for (size_t i = num_elements - 1; i >= 1; --i) {
+ elements[i]->parent()->removeChild(elements[i]);
+ }
+ end = clock();
+
+ std::cout << "Took " << double(end - begin) / double(CLOCKS_PER_SEC) << " seconds to remove " << num_elements << " elements\n";
+ }
+};
+#endif // SEEN_OBJECT_TEST_H
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
diff --git a/testfiles/src/cxxtests-to-migrate/preferences-test.h b/testfiles/src/cxxtests-to-migrate/preferences-test.h
new file mode 100644
index 000000000..92cb14247
--- /dev/null
+++ b/testfiles/src/cxxtests-to-migrate/preferences-test.h
@@ -0,0 +1,136 @@
+/** @file
+ * @brief Unit tests for the Preferences object
+ */
+/* Authors:
+ * Krzysztof KosiƄski <tweenk.pl@gmail.com>
+ *
+ * This file is released into the public domain.
+ */
+
+#include <cxxtest/TestSuite.h>
+#include "preferences.h"
+
+#include <glibmm/ustring.h>
+
+// test observer
+class TestObserver : public Inkscape::Preferences::Observer {
+public:
+ TestObserver(Glib::ustring const &path) :
+ Inkscape::Preferences::Observer(path),
+ value(0) {}
+
+ virtual void notify(Inkscape::Preferences::Entry const &val)
+ {
+ value = val.getInt();
+ }
+ int value;
+};
+
+class PreferencesTest : public CxxTest::TestSuite {
+public:
+ void setUp() {
+ prefs = Inkscape::Preferences::get();
+ }
+ void tearDown() {
+ prefs = NULL;
+ Inkscape::Preferences::unload();
+ }
+
+ void testStartingState()
+ {
+ TS_ASSERT_DIFFERS(prefs, static_cast<void*>(0));
+ TS_ASSERT_EQUALS(prefs->isWritable(), true);
+ }
+
+ void testOverwrite()
+ {
+ prefs->setInt("/test/intvalue", 123);
+ prefs->setInt("/test/intvalue", 321);
+ TS_ASSERT_EQUALS(prefs->getInt("/test/intvalue"), 321);
+ }
+
+ void testDefaultReturn()
+ {
+ TS_ASSERT_EQUALS(prefs->getInt("/this/path/does/not/exist", 123), 123);
+ }
+
+ void testLimitedReturn()
+ {
+ prefs->setInt("/test/intvalue", 1000);
+
+ // simple case
+ TS_ASSERT_EQUALS(prefs->getIntLimited("/test/intvalue", 123, 0, 500), 123);
+ // the below may seem quirky but this behaviour is intended
+ TS_ASSERT_EQUALS(prefs->getIntLimited("/test/intvalue", 123, 1001, 5000), 123);
+ // corner cases
+ TS_ASSERT_EQUALS(prefs->getIntLimited("/test/intvalue", 123, 0, 1000), 1000);
+ TS_ASSERT_EQUALS(prefs->getIntLimited("/test/intvalue", 123, 1000, 5000), 1000);
+ }
+
+ void testKeyObserverNotification()
+ {
+ Glib::ustring const path = "/some/random/path";
+ TestObserver obs("/some/random");
+ obs.value = 1;
+ prefs->setInt(path, 5);
+ TS_ASSERT_EQUALS(obs.value, 1); // no notifications sent before adding
+
+ prefs->addObserver(obs);
+ prefs->setInt(path, 10);
+ TS_ASSERT_EQUALS(obs.value, 10);
+ prefs->setInt("/some/other/random/path", 10);
+ TS_ASSERT_EQUALS(obs.value, 10); // value should not change
+
+ prefs->removeObserver(obs);
+ prefs->setInt(path, 15);
+ TS_ASSERT_EQUALS(obs.value, 10); // no notifications sent after removal
+ }
+
+ void testEntryObserverNotification()
+ {
+ Glib::ustring const path = "/some/random/path";
+ TestObserver obs(path);
+ obs.value = 1;
+ prefs->setInt(path, 5);
+ TS_ASSERT_EQUALS(obs.value, 1); // no notifications sent before adding
+
+ prefs->addObserver(obs);
+ prefs->setInt(path, 10);
+ TS_ASSERT_EQUALS(obs.value, 10);
+
+ // test that filtering works properly
+ prefs->setInt("/some/random/value", 1234);
+ TS_ASSERT_EQUALS(obs.value, 10);
+ prefs->setInt("/some/randomvalue", 1234);
+ TS_ASSERT_EQUALS(obs.value, 10);
+ prefs->setInt("/some/random/path2", 1234);
+ TS_ASSERT_EQUALS(obs.value, 10);
+
+ prefs->removeObserver(obs);
+ prefs->setInt(path, 15);
+ TS_ASSERT_EQUALS(obs.value, 10); // no notifications sent after removal
+ }
+
+ void testPreferencesEntryMethods()
+ {
+ prefs->setInt("/test/prefentry", 100);
+ Inkscape::Preferences::Entry val = prefs->getEntry("/test/prefentry");
+ TS_ASSERT(val.isValid());
+ TS_ASSERT_EQUALS(val.getPath(), "/test/prefentry");
+ TS_ASSERT_EQUALS(val.getEntryName(), "prefentry");
+ TS_ASSERT_EQUALS(val.getInt(), 100);
+ }
+private:
+ Inkscape::Preferences *prefs;
+};
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
diff --git a/testfiles/src/cxxtests-to-migrate/round-test.h b/testfiles/src/cxxtests-to-migrate/round-test.h
new file mode 100644
index 000000000..8e9ca69e0
--- /dev/null
+++ b/testfiles/src/cxxtests-to-migrate/round-test.h
@@ -0,0 +1,91 @@
+
+#ifndef SEEN_ROUND_TEST_H
+#define SEEN_ROUND_TEST_H
+
+#include <cxxtest/TestSuite.h>
+
+#include <vector>
+#include <round.h>
+
+class RoundTest : public CxxTest::TestSuite
+{
+public:
+ struct Case {
+ double arg0;
+ double ret;
+ };
+
+ std::vector<Case> nonneg_round_cases;
+ std::vector<Case> nonpos_round_cases;
+
+ RoundTest() :
+ TestSuite()
+ {
+ Case cases[] = {
+ { 5.0, 5.0 },
+ { 0.0, 0.0 },
+ { 5.4, 5.0 },
+ { 5.6, 6.0 },
+ { 1e-7, 0.0 },
+ { 1e7 + .49, 1e7 },
+ { 1e7 + .51, 1e7 + 1 },
+ { 1e12 + .49, 1e12 },
+ { 1e12 + .51, 1e12 + 1 },
+ { 1e40, 1e40 }
+ };
+
+ for ( size_t i = 0; i < G_N_ELEMENTS(cases); i++ )
+ {
+ nonneg_round_cases.push_back( cases[i] );
+
+ Case tmp = {-nonneg_round_cases[i].arg0, -nonneg_round_cases[i].ret};
+ nonpos_round_cases.push_back( tmp );
+ }
+ }
+
+ virtual ~RoundTest()
+ {
+ }
+
+ static RoundTest *createSuite() { return new RoundTest(); }
+ static void destroySuite( RoundTest *suite ) { delete suite; }
+
+// -------------------------------------------------------------------------
+// -------------------------------------------------------------------------
+
+
+
+ void testNonNegRound()
+ {
+ for ( size_t i = 0; i < nonneg_round_cases.size(); i++ )
+ {
+ double result = Inkscape::round( nonneg_round_cases[i].arg0 );
+ TS_ASSERT_EQUALS( result, nonneg_round_cases[i].ret );
+ }
+ }
+
+ void testNonPosRoung()
+ {
+ for ( size_t i = 0; i < nonpos_round_cases.size(); i++ )
+ {
+ double result = Inkscape::round( nonpos_round_cases[i].arg0 );
+ TS_ASSERT_EQUALS( result, nonpos_round_cases[i].ret );
+ }
+ }
+
+};
+
+
+#endif // SEEN_ROUND_TEST_H
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
+
diff --git a/testfiles/src/cxxtests-to-migrate/sp-gradient-test.h b/testfiles/src/cxxtests-to-migrate/sp-gradient-test.h
new file mode 100644
index 000000000..578d0c5c0
--- /dev/null
+++ b/testfiles/src/cxxtests-to-migrate/sp-gradient-test.h
@@ -0,0 +1,161 @@
+#ifndef SEEN_SP_GRADIENT_TEST_H
+#define SEEN_SP_GRADIENT_TEST_H
+
+#include "document-using-test.h"
+
+
+#include "sp-gradient.h"
+#include "svg/svg.h"
+#include "xml/repr.h"
+#include <2geom/transforms.h>
+#include "helper/geom.h"
+
+class SPGradientTest : public DocumentUsingTest
+{
+public:
+ SPDocument* _doc;
+
+ SPGradientTest() :
+ _doc(0)
+ {
+ }
+
+ virtual ~SPGradientTest()
+ {
+ if ( _doc )
+ {
+ _doc->doUnref();
+ }
+ }
+
+ static void createSuiteSubclass( SPGradientTest *& dst )
+ {
+ SPGradient *gr = static_cast<SPGradient *>(g_object_new(SP_TYPE_GRADIENT, NULL));
+ if ( gr ) {
+ UTEST_ASSERT(gr->gradientTransform.isIdentity());
+ UTEST_ASSERT(gr->gradientTransform == Geom::identity());
+ g_object_unref(gr);
+
+ dst = new SPGradientTest();
+ }
+ }
+
+ static SPGradientTest *createSuite()
+ {
+ return Inkscape::createSuiteAndDocument<SPGradientTest>( createSuiteSubclass );
+ }
+
+ static void destroySuite( SPGradientTest *suite ) { delete suite; }
+
+// -------------------------------------------------------------------------
+// -------------------------------------------------------------------------
+
+ void testSetGradientTransform()
+ {
+ SPGradient *gr = static_cast<SPGradient *>(g_object_new(SP_TYPE_GRADIENT, NULL));
+ SP_OBJECT(gr)->document = _doc;
+
+ SP_OBJECT(gr)->setKeyValue( SP_ATTR_GRADIENTTRANSFORM, "translate(5, 8)");
+ TS_ASSERT_EQUALS( gr->gradientTransform, Geom::Affine(Geom::Translate(5, 8)) );
+
+ SP_OBJECT(gr)->setKeyValue( SP_ATTR_GRADIENTTRANSFORM, "");
+ TS_ASSERT_EQUALS( gr->gradientTransform, Geom::identity() );
+
+ SP_OBJECT(gr)->setKeyValue( SP_ATTR_GRADIENTTRANSFORM, "rotate(90)");
+ TS_ASSERT_EQUALS( gr->gradientTransform, Geom::Affine(rotate_degrees(90)) );
+
+ g_object_unref(gr);
+ }
+
+
+ void testWrite()
+ {
+ SPGradient *gr = static_cast<SPGradient *>(g_object_new(SP_TYPE_GRADIENT, NULL));
+ SP_OBJECT(gr)->document = _doc;
+
+ SP_OBJECT(gr)->setKeyValue( SP_ATTR_GRADIENTTRANSFORM, "matrix(0, 1, -1, 0, 0, 0)");
+ Inkscape::XML::Document *xml_doc = _doc->getReprDoc();
+ Inkscape::XML::Node *repr = xml_doc->createElement("svg:radialGradient");
+ SP_OBJECT(gr)->updateRepr(repr, SP_OBJECT_WRITE_ALL);
+ {
+ gchar const *tr = repr->attribute("gradientTransform");
+ Geom::Affine svd;
+ bool const valid = sp_svg_transform_read(tr, &svd);
+ TS_ASSERT( valid );
+ TS_ASSERT_EQUALS( svd, Geom::Affine(rotate_degrees(90)) );
+ }
+
+ g_object_unref(gr);
+ }
+
+
+ void testGetG2dGetGs2dSetGs2d()
+ {
+ SPGradient *gr = static_cast<SPGradient *>(g_object_new(SP_TYPE_GRADIENT, NULL));
+ SP_OBJECT(gr)->document = _doc;
+ Geom::Affine const grXform(2, 1,
+ 1, 3,
+ 4, 6);
+ gr->gradientTransform = grXform;
+ Geom::Rect const unit_rect(Geom::Point(0, 0), Geom::Point(1, 1));
+ {
+ Geom::Affine const g2d(sp_gradient_get_g2d_matrix(gr, Geom::identity(), unit_rect));
+ Geom::Affine const gs2d(sp_gradient_get_gs2d_matrix(gr, Geom::identity(), unit_rect));
+ TS_ASSERT_EQUALS( g2d, Geom::identity() );
+ TS_ASSERT( Geom::are_near(gs2d, gr->gradientTransform * g2d, 1e-12) );
+
+ sp_gradient_set_gs2d_matrix(gr, Geom::identity(), unit_rect, gs2d);
+ TS_ASSERT( Geom::are_near(gr->gradientTransform, grXform, 1e-12) );
+ }
+
+ gr->gradientTransform = grXform;
+ Geom::Affine const funny(2, 3,
+ 4, 5,
+ 6, 7);
+ {
+ Geom::Affine const g2d(sp_gradient_get_g2d_matrix(gr, funny, unit_rect));
+ Geom::Affine const gs2d(sp_gradient_get_gs2d_matrix(gr, funny, unit_rect));
+ TS_ASSERT_EQUALS( g2d, funny );
+ TS_ASSERT( Geom::are_near(gs2d, gr->gradientTransform * g2d, 1e-12) );
+
+ sp_gradient_set_gs2d_matrix(gr, funny, unit_rect, gs2d);
+ TS_ASSERT( Geom::are_near(gr->gradientTransform, grXform, 1e-12) );
+ }
+
+ gr->gradientTransform = grXform;
+ Geom::Rect const larger_rect(Geom::Point(5, 6), Geom::Point(8, 10));
+ {
+ Geom::Affine const g2d(sp_gradient_get_g2d_matrix(gr, funny, larger_rect));
+ Geom::Affine const gs2d(sp_gradient_get_gs2d_matrix(gr, funny, larger_rect));
+ TS_ASSERT_EQUALS( g2d, Geom::Affine(3, 0,
+ 0, 4,
+ 5, 6) * funny );
+ TS_ASSERT( Geom::are_near(gs2d, gr->gradientTransform * g2d, 1e-12) );
+
+ sp_gradient_set_gs2d_matrix(gr, funny, larger_rect, gs2d);
+ TS_ASSERT( Geom::are_near(gr->gradientTransform, grXform, 1e-12) );
+
+ SP_OBJECT(gr)->setKeyValue( SP_ATTR_GRADIENTUNITS, "userSpaceOnUse");
+ Geom::Affine const user_g2d(sp_gradient_get_g2d_matrix(gr, funny, larger_rect));
+ Geom::Affine const user_gs2d(sp_gradient_get_gs2d_matrix(gr, funny, larger_rect));
+ TS_ASSERT_EQUALS( user_g2d, funny );
+ TS_ASSERT( Geom::are_near(user_gs2d, gr->gradientTransform * user_g2d, 1e-12) );
+ }
+ g_object_unref(gr);
+ }
+
+};
+
+
+#endif // SEEN_SP_GRADIENT_TEST_H
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
diff --git a/testfiles/src/cxxtests-to-migrate/sp-style-elem-test.h b/testfiles/src/cxxtests-to-migrate/sp-style-elem-test.h
new file mode 100644
index 000000000..6f65a48ea
--- /dev/null
+++ b/testfiles/src/cxxtests-to-migrate/sp-style-elem-test.h
@@ -0,0 +1,166 @@
+#ifndef SEEN_SP_STYLE_ELEM_TEST_H
+#define SEEN_SP_STYLE_ELEM_TEST_H
+
+#include <cxxtest/TestSuite.h>
+
+#include "test-helpers.h"
+
+#include "sp-style-elem.h"
+#include "xml/repr.h"
+
+class SPStyleElemTest : public CxxTest::TestSuite
+{
+public:
+ SPDocument* _doc;
+
+ SPStyleElemTest() :
+ _doc(0)
+ {
+ }
+
+ virtual ~SPStyleElemTest()
+ {
+ if ( _doc )
+ {
+ _doc->doUnref();
+ }
+ }
+
+ static void createSuiteSubclass( SPStyleElemTest *& dst )
+ {
+ SPStyleElem *style_elem = new SPStyleElem();
+
+ if ( style_elem ) {
+ TS_ASSERT(!style_elem->is_css);
+ TS_ASSERT(style_elem->media.print);
+ TS_ASSERT(style_elem->media.screen);
+ delete style_elem;
+
+ dst = new SPStyleElemTest();
+ }
+ }
+
+ static SPStyleElemTest *createSuite()
+ {
+ return Inkscape::createSuiteAndDocument<SPStyleElemTest>( createSuiteSubclass );
+ }
+
+ static void destroySuite( SPStyleElemTest *suite ) { delete suite; }
+
+// -------------------------------------------------------------------------
+// -------------------------------------------------------------------------
+
+
+ void testSetType()
+ {
+ SPStyleElem *style_elem = new SPStyleElem();
+ SP_OBJECT(style_elem)->document = _doc;
+
+ SP_OBJECT(style_elem)->setKeyValue( SP_ATTR_TYPE, "something unrecognized");
+ TS_ASSERT( !style_elem->is_css );
+
+ SP_OBJECT(style_elem)->setKeyValue( SP_ATTR_TYPE, "text/css");
+ TS_ASSERT( style_elem->is_css );
+
+ SP_OBJECT(style_elem)->setKeyValue( SP_ATTR_TYPE, "atext/css");
+ TS_ASSERT( !style_elem->is_css );
+
+ SP_OBJECT(style_elem)->setKeyValue( SP_ATTR_TYPE, "text/cssx");
+ TS_ASSERT( !style_elem->is_css );
+
+ delete style_elem;
+ }
+
+ void testWrite()
+ {
+ TS_ASSERT( _doc );
+ TS_ASSERT( _doc->getReprDoc() );
+ if ( !_doc->getReprDoc() ) {
+ return; // evil early return
+ }
+
+ SPStyleElem *style_elem = new SPStyleElem();
+ SP_OBJECT(style_elem)->document = _doc;
+
+ SP_OBJECT(style_elem)->setKeyValue( SP_ATTR_TYPE, "text/css");
+ Inkscape::XML::Node *repr = _doc->getReprDoc()->createElement("svg:style");
+ SP_OBJECT(style_elem)->updateRepr(_doc->getReprDoc(), repr, SP_OBJECT_WRITE_ALL);
+ {
+ gchar const *typ = repr->attribute("type");
+ TS_ASSERT( typ != NULL );
+ if ( typ )
+ {
+ TS_ASSERT_EQUALS( std::string(typ), std::string("text/css") );
+ }
+ }
+
+ delete style_elem;
+ }
+
+ void testBuild()
+ {
+ TS_ASSERT( _doc );
+ TS_ASSERT( _doc->getReprDoc() );
+ if ( !_doc->getReprDoc() ) {
+ return; // evil early return
+ }
+
+ SPStyleElem *style_elem = new SPStyleElem();
+ Inkscape::XML::Node *const repr = _doc->getReprDoc()->createElement("svg:style");
+ repr->setAttribute("type", "text/css");
+ style_elem->invoke_build( _doc, repr, false);
+ TS_ASSERT( style_elem->is_css );
+ TS_ASSERT( style_elem->media.print );
+ TS_ASSERT( style_elem->media.screen );
+
+ /* Some checks relevant to the read_content test below. */
+ {
+ g_assert(_doc->style_cascade);
+ CRStyleSheet const *const stylesheet = cr_cascade_get_sheet(_doc->style_cascade, ORIGIN_AUTHOR);
+ g_assert(stylesheet);
+ g_assert(stylesheet->statements == NULL);
+ }
+
+ delete style_elem;
+ Inkscape::GC::release(repr);
+ }
+
+ void testReadContent()
+ {
+ TS_ASSERT( _doc );
+ TS_ASSERT( _doc->getReprDoc() );
+ if ( !_doc->getReprDoc() ) {
+ return; // evil early return
+ }
+
+ SPStyleElem *style_elem = new SPStyleElem();
+ Inkscape::XML::Node *const repr = _doc->getReprDoc()->createElement("svg:style");
+ repr->setAttribute("type", "text/css");
+ Inkscape::XML::Node *const content_repr = _doc->getReprDoc()->createTextNode(".myclass { }");
+ repr->addChild(content_repr, NULL);
+ style_elem->invoke_build(_doc, repr, false);
+ TS_ASSERT( style_elem->is_css );
+ TS_ASSERT( _doc->style_cascade );
+ CRStyleSheet const *const stylesheet = cr_cascade_get_sheet(_doc->style_cascade, ORIGIN_AUTHOR);
+ TS_ASSERT(stylesheet != NULL);
+ TS_ASSERT(stylesheet->statements != NULL);
+
+ delete style_elem;
+ Inkscape::GC::release(repr);
+ }
+
+};
+
+
+#endif // SEEN_SP_STYLE_ELEM_TEST_H
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
diff --git a/testfiles/src/cxxtests-to-migrate/style-test.h b/testfiles/src/cxxtests-to-migrate/style-test.h
new file mode 100644
index 000000000..c6bb665e0
--- /dev/null
+++ b/testfiles/src/cxxtests-to-migrate/style-test.h
@@ -0,0 +1,537 @@
+#ifndef SEEN_STYLE_TEST_H
+#define SEEN_STYLE_TEST_H
+
+#include <cxxtest/TestSuite.h>
+
+#include "test-helpers.h"
+
+#include "style.h"
+
+class StyleTest : public CxxTest::TestSuite
+{
+public:
+ SPDocument* _doc;
+
+ StyleTest() :
+ _doc(0)
+ {
+ }
+
+ virtual ~StyleTest()
+ {
+ if ( _doc )
+ {
+ _doc->doUnref();
+ _doc = 0;
+ }
+ }
+
+ static void createSuiteSubclass( StyleTest*& dst )
+ {
+ dst = new StyleTest();
+ }
+
+// createSuite and destroySuite get us per-suite setup and teardown
+// without us having to worry about static initialization order, etc.
+ static StyleTest *createSuite()
+ {
+ StyleTest* suite = Inkscape::createSuiteAndDocument<StyleTest>( createSuiteSubclass );
+ return suite;
+ }
+
+ static void destroySuite( StyleTest *suite )
+ {
+ delete suite;
+ }
+
+ // ---------------------------------------------------------------
+ // ---------------------------------------------------------------
+ // ---------------------------------------------------------------
+
+ // Reading and writing style string
+ void testOne()
+ {
+ struct TestCase {
+ TestCase(gchar const* src, gchar const* dst = 0, gchar const* uri = 0) : src(src), dst(dst), uri(uri) {}
+ gchar const* src;
+ gchar const* dst;
+ gchar const* uri;
+ };
+
+ TestCase cases[] = {
+ TestCase("fill:none"),
+ TestCase("fill:currentColor"),
+ TestCase("fill:#ff00ff"),
+
+ TestCase("fill:rgb(100%, 0%, 100%)", "fill:#ff00ff"),
+ // TODO - fix this to preserve the string
+ TestCase("fill:url(#painter) rgb(100%, 0%, 100%)",
+ "fill:url(#painter) #ff00ff", "#painter"),
+
+ TestCase("fill:rgb(255, 0, 255)", "fill:#ff00ff"),
+ // TODO - fix this to preserve the string
+ TestCase("fill:url(#painter) rgb(255, 0, 255)",
+ "fill:url(#painter) #ff00ff", "#painter"),
+
+
+// TestCase("fill:#ff00ff icc-color(colorChange, 0.1, 0.5, 0.1)"),
+
+ TestCase("fill:url(#painter)", 0, "#painter"),
+ TestCase("fill:url(#painter) none", 0, "#painter"),
+ TestCase("fill:url(#painter) currentColor", 0, "#painter"),
+ TestCase("fill:url(#painter) #ff00ff", 0, "#painter"),
+// TestCase("fill:url(#painter) rgb(100%, 0%, 100%)", 0, "#painter"),
+// TestCase("fill:url(#painter) rgb(255, 0, 255)", 0, "#painter"),
+
+ TestCase("fill:url(#painter) #ff00ff icc-color(colorChange, 0.1, 0.5, 0.1)", 0, "#painter"),
+
+// TestCase("fill:url(#painter) inherit", 0, "#painter"),
+ TestCase("fill:inherit"),
+
+// General tests (in general order of appearance in sp_style_read), SPIPaint tested above
+ TestCase("visibility:hidden"), // SPIEnum
+ TestCase("visibility:collapse"),
+ TestCase("visibility:visible"),
+ TestCase("display:none"), // SPIEnum
+ TestCase("overflow:visible"), // SPIEnum
+ TestCase("overflow:auto"), // SPIEnum
+
+ TestCase("color:#ff0000"),
+ TestCase("color:blue", "color:#0000ff"),
+ // TestCase("color:currentColor"), SVG 1.1 does not allow color value 'currentColor'
+
+ // Font shorthand
+ TestCase("font:bold 12px Arial",
+ "font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:12px;line-height:normal;font-family:Arial"),
+ TestCase("font:bold 12px/24px 'Times New Roman'",
+ "font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:12px;line-height:24px;font-family:\'Times New Roman\'"),
+ // From CSS 3 Fonts (examples):
+ TestCase("font: 12pt/15pt sans-serif",
+ "font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:16px;line-height:15pt;font-family:sans-serif"),
+ TestCase("font: 80% sans-serif",
+ "font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:80%;line-height:normal;font-family:sans-serif"),
+ TestCase("font: x-large/110% 'new century schoolbook', serif",
+ "font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:x-large;line-height:110%;font-family:\'new century schoolbook\', serif"),
+ TestCase("font: bold italic large Palatino, serif",
+ "font-style:italic;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:large;line-height:normal;font-family:Palatino, serif"),
+ TestCase("font: normal small-caps 120%/120% fantasy",
+ "font-style:normal;font-variant:small-caps;font-weight:normal;font-stretch:normal;font-size:120%;line-height:120%;font-family:fantasy"),
+ TestCase("font: condensed oblique 12pt 'Helvetica Neue', serif;",
+ "font-style:oblique;font-variant:normal;font-weight:normal;font-stretch:condensed;font-size:16px;line-height:normal;font-family:\'Helvetica Neue\', serif"),
+
+ TestCase("font-family:sans-serif"), // SPIString, text_private
+ TestCase("font-family:Arial"),
+ // TestCase("font-variant:normal;font-stretch:normal;-inkscape-font-specification:Nimbus Roman No9 L Bold Italic"),
+
+ // Needs to be fixed (quotes should be around each font-family):
+ TestCase("font-family:Georgia, 'Minion Web'","font-family:Georgia, \'Minion Web\'"),
+ TestCase("font-size:12", "font-size:12px"), // SPIFontSize
+ TestCase("font-size:12px"),
+ TestCase("font-size:12pt", "font-size:16px"),
+ TestCase("font-size:medium"),
+ TestCase("font-size:smaller"),
+ TestCase("font-style:italic"), // SPIEnum
+ TestCase("font-variant:small-caps"), // SPIEnum
+ TestCase("font-weight:100"), // SPIEnum
+ TestCase("font-weight:normal"),
+ TestCase("font-weight:bolder"),
+ TestCase("font-stretch:condensed"), // SPIEnum
+
+ TestCase("font-variant-ligatures:none"), // SPILigatures
+ TestCase("font-variant-ligatures:normal"),
+ TestCase("font-variant-ligatures:no-common-ligatures"),
+ TestCase("font-variant-ligatures:discretionary-ligatures"),
+ TestCase("font-variant-ligatures:historical-ligatures"),
+ TestCase("font-variant-ligatures:no-contextual"),
+ TestCase("font-variant-ligatures:common-ligatures", "font-variant-ligatures:normal"),
+ TestCase("font-variant-ligatures:contextual", "font-variant-ligatures:normal"),
+ TestCase("font-variant-ligatures:no-common-ligatures historical-ligatures"),
+ TestCase("font-variant-ligatures:historical-ligatures no-contextual"),
+ TestCase("font-variant-position:normal"),
+ TestCase("font-variant-position:sub"),
+ TestCase("font-variant-position:super"),
+ TestCase("font-variant-caps:normal"),
+ TestCase("font-variant-caps:small-caps"),
+ TestCase("font-variant-caps:all-small-caps"),
+ TestCase("font-variant-numeric:normal"),
+ TestCase("font-variant-numeric:lining-nums"),
+ TestCase("font-variant-numeric:oldstyle-nums"),
+ TestCase("font-variant-numeric:proportional-nums"),
+ TestCase("font-variant-numeric:tabular-nums"),
+ TestCase("font-variant-numeric:diagonal-fractions"),
+ TestCase("font-variant-numeric:stacked-fractions"),
+ TestCase("font-variant-numeric:ordinal"),
+ TestCase("font-variant-numeric:slashed-zero"),
+ TestCase("font-variant-numeric:tabular-nums slashed-zero"),
+ TestCase("font-variant-numeric:tabular-nums proportional-nums", "font-variant-numeric:proportional-nums"),
+
+ // Should be moved down
+ TestCase("text-indent:12em"), // SPILength?
+ TestCase("text-align:center"), // SPIEnum
+
+ // SPITextDecoration
+ // The default value for 'text-decoration-color' is 'currentColor', but
+ // we cannot set the default to that value yet. (We need to switch
+ // SPIPaint to SPIColor and then add the ability to set default.)
+ // TestCase("text-decoration: underline",
+ // "text-decoration: underline;text-decoration-line: underline;text-decoration-color:currentColor"),
+ // TestCase("text-decoration: overline underline",
+ // "text-decoration: underline overline;text-decoration-line: underline overline;text-decoration-color:currentColor"),
+
+ TestCase("text-decoration: underline wavy #0000ff",
+ "text-decoration: underline;text-decoration-line: underline;text-decoration-style:wavy;text-decoration-color:#0000ff"),
+ TestCase("text-decoration: double overline underline #ff0000",
+ "text-decoration: underline overline;text-decoration-line: underline overline;text-decoration-style:double;text-decoration-color:#ff0000"),
+
+ // SPITextDecorationLine
+ TestCase("text-decoration-line: underline",
+ "text-decoration: underline;text-decoration-line: underline"),
+
+ // SPITextDecorationStyle
+ TestCase("text-decoration-style:solid"),
+ TestCase("text-decoration-style:dotted"),
+
+ // SPITextDecorationColor
+ TestCase("text-decoration-color:#ff00ff"),
+
+ // Should be moved up
+ TestCase("line-height:24px"), // SPILengthOrNormal
+ TestCase("line-height:1.5"),
+ TestCase("letter-spacing:2px"), // SPILengthOrNormal
+ TestCase("word-spacing:2px"), // SPILengthOrNormal
+ TestCase("word-spacing:normal"),
+ TestCase("text-transform:lowercase"), // SPIEnum
+ // ...
+ TestCase("baseline-shift:baseline"), // SPIBaselineShift
+ TestCase("baseline-shift:sub"),
+ TestCase("baseline-shift:12.5%"),
+ TestCase("baseline-shift:2px"),
+
+ TestCase("opacity:0.1"), // SPIScale24
+ // ...
+ TestCase("stroke-width:2px"), // SPILength
+ TestCase("stroke-linecap:round"), // SPIEnum
+ TestCase("stroke-linejoin:round"), // SPIEnum
+ TestCase("stroke-miterlimit:4"), // SPIFloat
+ TestCase("marker:url(#Arrow)"), // SPIString
+ TestCase("marker-start:url(#Arrow)"),
+ TestCase("marker-mid:url(#Arrow)"),
+ TestCase("marker-end:url(#Arrow)"),
+ TestCase("stroke-opacity:0.5"), // SPIScale24
+ TestCase("stroke-dasharray:0, 1, 0, 1"), // SPIDashArray
+ TestCase("stroke-dasharray:0 1 0 1","stroke-dasharray:0, 1, 0, 1"),
+ TestCase("stroke-dasharray:0 1 2 3","stroke-dasharray:0, 1, 2, 3"),
+ TestCase("stroke-dashoffset:13"), // SPILength
+ TestCase("stroke-dashoffset:10px"),
+ // ...
+ //TestCase("filter:url(#myfilter)"), // SPIFilter segfault in read
+ TestCase("filter:inherit"),
+
+ TestCase("opacity:0.1;fill:#ff0000;stroke:#0000ff;stroke-width:2px"),
+ TestCase("opacity:0.1;fill:#ff0000;stroke:#0000ff;stroke-width:2px;stroke-dasharray:1, 2, 3, 4;stroke-dashoffset:15"),
+
+
+#ifdef WITH_SVG2
+ TestCase("paint-order:stroke"), // SPIPaintOrder
+ TestCase("paint-order:normal"),
+ TestCase("paint-order: markers stroke fill", "paint-order:markers stroke fill"),
+
+#endif
+ TestCase(0)
+ };
+
+ for ( gint i = 0; cases[i].src; i++ ) {
+ // std::cout << "Test one: " << i << std::endl;
+ SPStyle style(_doc);
+ style.mergeString( cases[i].src );
+ if ( cases[i].uri ) {
+ TSM_ASSERT( cases[i].src, style.fill.value.href );
+ if ( style.fill.value.href ) {
+ TS_ASSERT_EQUALS( style.fill.value.href->getURI()->toString(), std::string(cases[i].uri) );
+ }
+ } else {
+ TS_ASSERT( !style.fill.value.href || !style.fill.value.href->getObject() );
+ }
+
+ std::string str0_set = style.write(SP_STYLE_FLAG_IFSET );
+
+ if ( cases[i].dst ) {
+ // std::cout << " " << str0_set << " " << std::string(cases[i].dst) << std::endl;
+ TS_ASSERT_EQUALS( str0_set, std::string(cases[i].dst) );
+ } else {
+ // std::cout << " " << str0_set << " " << std::string(cases[i].src) << std::endl;
+ TS_ASSERT_EQUALS( str0_set, std::string(cases[i].src) );
+ }
+ }
+ }
+
+ // Testing operator==
+ void testTwo()
+ {
+ struct TestCase {
+ TestCase(gchar const* src, gchar const* dst, bool match) :
+ src(src), dst(dst), match(match) {}
+ gchar const* src;
+ gchar const* dst;
+ bool match;
+ };
+
+ TestCase cases[] = {
+
+ // SPIFloat
+ TestCase("stroke-miterlimit:4", "stroke-miterlimit:4", true ),
+ TestCase("stroke-miterlimit:4", "stroke-miterlimit:2", false),
+ TestCase("stroke-miterlimit:4", "", true ), // Default
+
+ // SPIScale24
+ TestCase("opacity:0.3", "opacity:0.3", true ),
+ TestCase("opacity:0.3", "opacity:0.6", false),
+ TestCase("opacity:1.0", "", true ), // Default
+
+ // SPILength
+ TestCase("text-indent:3", "text-indent:3", true ),
+ TestCase("text-indent:6", "text-indent:3", false),
+ TestCase("text-indent:6px", "text-indent:3", false),
+ TestCase("text-indent:1px", "text-indent:12pc", false),
+ TestCase("text-indent:2ex", "text-indent:2ex", false),
+
+ // SPILengthOrNormal
+ TestCase("letter-spacing:normal", "letter-spacing:normal", true ),
+ TestCase("letter-spacing:2", "letter-spacing:normal", false),
+ TestCase("letter-spacing:normal", "letter-spacing:2", false),
+ TestCase("letter-spacing:5px", "letter-spacing:5px", true ),
+ TestCase("letter-spacing:10px", "letter-spacing:5px", false),
+ TestCase("letter-spacing:10em", "letter-spacing:10em", false),
+
+ // SPIEnum
+ TestCase("text-anchor:start", "text-anchor:start", true ),
+ TestCase("text-anchor:start", "text-anchor:middle", false),
+ TestCase("text-anchor:start", "", true ), // Default
+ TestCase("text-anchor:start", "text-anchor:junk", true ), // Bad value
+
+ TestCase("font-weight:normal", "font-weight:400", true ),
+ TestCase("font-weight:bold", "font-weight:700", true ),
+
+
+ // SPIString and SPIFontString
+ TestCase("font-family:Arial", "font-family:Arial", true ),
+ TestCase("font-family:A B", "font-family:A B", true ),
+ TestCase("font-family:A B", "font-family:A C", false),
+ // Default is not set by class... value is NULL which cannot be compared
+ // TestCase("font-family:sans-serif", "", true ), // Default
+
+ // SPIColor
+ TestCase("color:blue", "color:blue", true ),
+ TestCase("color:blue", "color:red", false),
+ TestCase("color:red", "color:#ff0000", true ),
+
+ // SPIPaint
+ TestCase("fill:blue", "fill:blue", true ),
+ TestCase("fill:blue", "fill:red", false),
+ TestCase("fill:currentColor", "fill:currentColor", true ),
+ TestCase("fill:url(#xxx)", "fill:url(#xxx)", true ),
+ // Needs URL defined as in test 1
+ //TestCase("fill:url(#xxx)", "fill:url(#yyy)", false),
+
+ // SPIPaintOrder
+ TestCase("paint-order:markers", "paint-order:markers", true ),
+ TestCase("paint-order:markers", "paint-order:stroke", false),
+ //TestCase("paint-order:fill stroke markers", "", true ), // Default
+ TestCase("paint-order:normal", "paint-order:normal", true ),
+ //TestCase("paint-order:fill stroke markers", "paint-order:normal", true ),
+
+ // SPIDashArray
+ TestCase("stroke-dasharray:0 1 2 3","stroke-dasharray:0 1 2 3",true ),
+ TestCase("stroke-dasharray:0 1", "stroke-dasharray:0 2", false),
+
+ // SPIFilter
+
+ // SPIFontSize
+ TestCase("font-size:12px", "font-size:12px", true ),
+ TestCase("font-size:12px", "font-size:24px", false),
+ TestCase("font-size:12ex", "font-size:24ex", false),
+ TestCase("font-size:medium", "font-size:medium", true ),
+ TestCase("font-size:medium", "font-size:large", false),
+
+ // SPIBaselineShift
+ TestCase("baseline-shift:baseline", "baseline-shift:baseline", true ),
+ TestCase("baseline-shift:sub", "baseline-shift:sub", true ),
+ TestCase("baseline-shift:sub", "baseline-shift:super", false),
+ TestCase("baseline-shift:baseline", "baseline-shift:sub", false),
+ TestCase("baseline-shift:10px", "baseline-shift:10px", true ),
+ TestCase("baseline-shift:10px", "baseline-shift:12px", false),
+
+
+ // SPITextDecorationLine
+ TestCase("text-decoration-line:underline", "text-decoration-line:underline", true ),
+ TestCase("text-decoration-line:underline", "text-decoration-line:overline", false),
+ TestCase("text-decoration-line:underline overline", "text-decoration-line:underline overline", true ),
+ TestCase("text-decoration-line:none", "", true ), // Default
+
+
+ // SPITextDecorationStyle
+ TestCase("text-decoration-style:solid", "text-decoration-style:solid", true ),
+ TestCase("text-decoration-style:dotted", "text-decoration-style:solid", false),
+ TestCase("text-decoration-style:solid", "", true ), // Default
+
+ // SPITextDecoration
+ TestCase("text-decoration:underline", "text-decoration:underline", true ),
+ TestCase("text-decoration:underline", "text-decoration:overline", false),
+ TestCase("text-decoration:underline overline","text-decoration:underline overline",true ),
+ TestCase("text-decoration:overline underline","text-decoration:underline overline",true ),
+ // TestCase("text-decoration:none", "text-decoration-color:currentColor", true ), // Default
+
+
+ // Terminate
+ TestCase(0,0,0)
+ };
+ for ( gint i = 0; cases[i].src; i++ ) {
+ // std::cout << "Test two: " << i << std::endl;
+ SPStyle style_src(_doc);
+ SPStyle style_dst(_doc);
+
+ style_src.mergeString( cases[i].src );
+ style_dst.mergeString( cases[i].dst );
+
+ // std::cout << "Test:" << std::endl;
+ // std::cout << " C: |" << cases[i].src << "| |" << cases[i].dst << "|" << std::endl;
+ // std::cout << " S: |" << style_src.write( SP_STYLE_FLAG_IFSET, NULL ) << "| |"
+ // << style_dst.write( SP_STYLE_FLAG_IFSET, NULL ) << "|" <<std::endl;
+ TS_ASSERT( (style_src == style_dst) == cases[i].match );
+ // std::cout << "End Test\n" << std::endl;
+ }
+ }
+
+
+ // Test of cascade
+ void testThree()
+ {
+ struct TestCase {
+ TestCase(gchar const* parent, gchar const* child, gchar const* result) :
+ parent(parent), child(child), result(result) {}
+ gchar const* parent;
+ gchar const* child;
+ gchar const* result;
+ };
+
+ TestCase cases[] = {
+
+ // SPIFloat
+ TestCase("stroke-miterlimit:6", "stroke-miterlimit:2", "stroke-miterlimit:2" ),
+ TestCase("stroke-miterlimit:6", "", "stroke-miterlimit:6" ),
+ TestCase("", "stroke-miterlimit:2", "stroke-miterlimit:2" ),
+
+ // SPIScale24
+ TestCase("opacity:0.3", "opacity:0.3", "opacity:0.3" ),
+ TestCase("opacity:0.3", "opacity:0.6", "opacity:0.6" ),
+ // 'opacity' does not inherit
+ TestCase("opacity:0.3", "", "opacity:1.0" ),
+ TestCase("", "opacity:0.3", "opacity:0.3" ),
+ TestCase("opacity:0.5", "opacity:inherit", "opacity:0.5" ),
+ TestCase("", "", "opacity:1.0" ),
+
+ // SPILength
+ TestCase("text-indent:3", "text-indent:3", "text-indent:3" ),
+ TestCase("text-indent:6", "text-indent:3", "text-indent:3" ),
+ TestCase("text-indent:6px", "text-indent:3", "text-indent:3" ),
+ TestCase("text-indent:1px", "text-indent:12pc", "text-indent:12pc" ),
+ // ex, em cannot be equal
+ //TestCase("text-indent:2ex", "text-indent:2ex", "text-indent:2ex" ),
+ TestCase("text-indent:3", "", "text-indent:3" ),
+ TestCase("text-indent:3", "text-indent:inherit", "text-indent:3" ),
+
+ // SPILengthOrNormal
+ TestCase("letter-spacing:normal", "letter-spacing:normal", "letter-spacing:normal" ),
+ TestCase("letter-spacing:2", "letter-spacing:normal", "letter-spacing:normal" ),
+ TestCase("letter-spacing:normal", "letter-spacing:2", "letter-spacing:2" ),
+ TestCase("letter-spacing:5px", "letter-spacing:5px", "letter-spacing:5px" ),
+ TestCase("letter-spacing:10px", "letter-spacing:5px", "letter-spacing:5px" ),
+ // ex, em cannot be equal
+ // TestCase("letter-spacing:10em", "letter-spacing:10em", "letter-spacing:10em" ),
+
+ // SPIEnum
+ TestCase("text-anchor:start", "text-anchor:start", "text-anchor:start" ),
+ TestCase("text-anchor:start", "text-anchor:middle", "text-anchor:middle" ),
+ TestCase("text-anchor:start", "", "text-anchor:start" ),
+ TestCase("text-anchor:start", "text-anchor:junk", "text-anchor:start" ),
+ TestCase("text-anchor:end", "text-anchor:inherit", "text-anchor:end" ),
+
+ TestCase("font-weight:400", "font-weight:400", "font-weight:400" ),
+ TestCase("font-weight:400", "font-weight:700", "font-weight:700" ),
+ TestCase("font-weight:400", "font-weight:bolder", "font-weight:700" ),
+ TestCase("font-weight:700", "font-weight:bolder", "font-weight:900" ),
+ TestCase("font-weight:400", "font-weight:lighter", "font-weight:100" ),
+ TestCase("font-weight:200", "font-weight:lighter", "font-weight:100" ),
+
+ TestCase("font-stretch:condensed","font-stretch:expanded", "font-stretch:expanded" ),
+ TestCase("font-stretch:condensed","font-stretch:wider", "font-stretch:semi-condensed" ),
+
+ // SPIString and SPIFontString
+
+ // SPIPaint
+
+ // SPIPaintOrder
+
+ // SPIDashArray
+
+ // SPIFilter
+
+ // SPIFontSize
+
+ // SPIBaselineShift
+
+
+ // SPITextDecorationLine
+ TestCase("text-decoration-line:overline", "text-decoration-line:underline",
+ "text-decoration-line:underline" ),
+
+ // SPITextDecorationStyle
+
+ // SPITextDecoration
+
+ // Terminate
+ TestCase(0,0,0)
+ };
+ for ( gint i = 0; cases[i].parent; i++ ) {
+ // std::cout << "Test three: " << i << std::endl;
+ SPStyle style_parent(_doc);
+ SPStyle style_child( _doc);
+ SPStyle style_result(_doc);
+
+ style_parent.mergeString( cases[i].parent );
+ style_child.mergeString( cases[i].child );
+ style_result.mergeString( cases[i].result );
+
+ // std::cout << "Test:" << std::endl;
+ // std::cout << " Input: ";
+ // std::cout << " Parent: " << cases[i].parent
+ // << " Child: " << cases[i].child
+ // << " Result: " << cases[i].result << std::endl;
+ // std::cout << " Write: ";
+ // std::cout << " Parent: " << style_parent.write( SP_STYLE_FLAG_IFSET )
+ // << " Child: " << style_child.write( SP_STYLE_FLAG_IFSET )
+ // << " Result: " << style_result.write( SP_STYLE_FLAG_IFSET ) << std::endl;
+
+ style_child.cascade( &style_parent );
+
+ TS_ASSERT(style_child == style_result );
+
+ // std::cout << "End Test: *************\n" << std::endl;
+ }
+ }
+
+};
+
+
+#endif // SEEN_STYLE_TEST_H
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
diff --git a/testfiles/src/cxxtests-to-migrate/test-helpers.h b/testfiles/src/cxxtests-to-migrate/test-helpers.h
new file mode 100644
index 000000000..d30449ebb
--- /dev/null
+++ b/testfiles/src/cxxtests-to-migrate/test-helpers.h
@@ -0,0 +1,66 @@
+#ifndef SEEN_TEST_HELPERS_H
+#define SEEN_TEST_HELPERS_H
+
+
+#include <cxxtest/TestSuite.h>
+
+#include "document.h"
+#include "inkscape.h"
+
+
+// Dummy functions to keep linker happy
+#if !defined(DUMMY_MAIN_TEST_CALLS_SEEN)
+#define DUMMY_MAIN_TEST_CALLS_SEEN
+int sp_main_gui (int, char const**) { return 0; }
+int sp_main_console (int, char const**) { return 0; }
+#endif // DUMMY_MAIN_TEST_CALLS_SEEN
+
+namespace Inkscape
+{
+
+template <class T>
+T* createSuiteAndDocument( void (*fun)(T*&) )
+{
+ T* suite = 0;
+
+#if !GLIB_CHECK_VERSION(2,36,0)
+ g_type_init();
+#endif
+
+ Inkscape::GC::init();
+ if ( !Inkscape::Application::exists() )
+ {
+ // Create the global inkscape object.
+ Inkscape::Application::create("", false);
+ }
+
+ SPDocument* tmp = SPDocument::createNewDoc( NULL, TRUE, true );
+ if ( tmp ) {
+ fun( suite );
+ if ( suite )
+ {
+ suite->_doc = tmp;
+ }
+ else
+ {
+ tmp->doUnref();
+ }
+ }
+
+ return suite;
+}
+
+} // namespace Inkscape
+
+#endif // SEEN_TEST_HELPERS_H
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
diff --git a/testfiles/src/cxxtests-to-migrate/uri-test.h b/testfiles/src/cxxtests-to-migrate/uri-test.h
new file mode 100644
index 000000000..2a4cdab46
--- /dev/null
+++ b/testfiles/src/cxxtests-to-migrate/uri-test.h
@@ -0,0 +1,90 @@
+
+#ifndef SEEN_URI_TEST_H
+#define SEEN_URI_TEST_H
+/*
+ * Test uri.h
+ *
+ * Written to aid with refactoring the uri handling to support fullPath
+ * and data URIs and also cover code which wasn't before tested.
+ *
+ * Copyright 2014 (c) BasisTech Boston
+ *
+ */
+#include <cxxtest/TestSuite.h>
+
+#include "uri.h"
+
+using Inkscape::URI;
+
+class URITest : public CxxTest::TestSuite
+{
+public:
+ void stringTest( std::string result, std::string expected )
+ {
+ if ( !result.empty() && !expected.empty() ) {
+ TS_ASSERT_EQUALS( result, expected );
+ } else if ( result.empty() && !expected.empty() ) {
+ TS_FAIL( std::string("Expected (") + expected + "), found null" );
+ } else if ( !result.empty() && expected.empty() ) {
+ TS_FAIL( std::string("Expected null, found (") + result + ")" );
+ }
+ }
+
+ std::string ValueOrEmpty(const char* s) {
+ return s == NULL ? std::string() : s;
+ }
+
+ void toStringTest( std::string uri, std::string expected ) {
+ stringTest( URI(uri.c_str()).toString(), expected );
+ }
+ void pathTest( std::string uri, std::string expected ) {
+ stringTest( ValueOrEmpty(URI(uri.c_str()).getPath()), expected );
+ }
+
+ void testToString()
+ {
+ char const* cases[][2] = {
+ { "foo", "foo" },
+ { "#foo", "#foo" },
+ { "blah.svg#h", "blah.svg#h" },
+ //{ "data:data", "data:data" },
+ };
+
+ for ( size_t i = 0; i < G_N_ELEMENTS(cases); i++ ) {
+ toStringTest( std::string(cases[i][0]), std::string(cases[i][1]) );
+ }
+ }
+
+ void testPath()
+ {
+ char const* cases[][2] = {
+ { "foo.svg", "foo.svg" },
+ { "foo.svg#bar", "foo.svg" },
+ { "#bar", NULL },
+ { "data:data", NULL },
+ };
+
+ for ( size_t i = 0; i < G_N_ELEMENTS(cases); i++ ) {
+ pathTest( ValueOrEmpty(cases[i][0]), ValueOrEmpty(cases[i][1]) );
+ }
+ }
+ void testFullPath() {
+ std::ofstream fhl("/tmp/cxxtest-uri.svg", std::ofstream::out);
+ stringTest( URI("cxxtest-uri.svg").getFullPath("/tmp"), std::string("/tmp/cxxtest-uri.svg") );
+ stringTest( URI("cxxtest-uri.svg").getFullPath("/usr/../tmp"), std::string("/tmp/cxxtest-uri.svg") );
+ }
+
+};
+
+#endif // SEEN_URI_TEST_H
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
diff --git a/testfiles/src/cxxtests-to-migrate/verbs-test.h b/testfiles/src/cxxtests-to-migrate/verbs-test.h
new file mode 100644
index 000000000..04a0b80c0
--- /dev/null
+++ b/testfiles/src/cxxtests-to-migrate/verbs-test.h
@@ -0,0 +1,86 @@
+
+
+#include <cxxtest/TestSuite.h>
+
+#include "verbs.h"
+
+class VerbsTest : public CxxTest::TestSuite
+{
+public:
+
+ class TestHook : public Inkscape::Verb {
+ public:
+ static int getInternalTableSize() { return _getBaseListSize(); }
+
+ private:
+ TestHook();
+ };
+
+ void testEnumLength()
+ {
+ TS_ASSERT_DIFFERS( 0, static_cast<int>(SP_VERB_LAST) );
+ TS_ASSERT_EQUALS( static_cast<int>(SP_VERB_LAST) + 1, TestHook::getInternalTableSize() );
+ }
+
+ void testEnumFixed()
+ {
+ TS_ASSERT_EQUALS( 0, static_cast<int>(SP_VERB_INVALID) );
+ TS_ASSERT_EQUALS( 1, static_cast<int>(SP_VERB_NONE) );
+
+ TS_ASSERT_DIFFERS( 0, static_cast<int>(SP_VERB_LAST) );
+ TS_ASSERT_DIFFERS( 1, static_cast<int>(SP_VERB_LAST) );
+ }
+
+ void testFetch()
+ {
+ for ( int i = 0; i < static_cast<int>(SP_VERB_LAST); i++ )
+ {
+ char tmp[16];
+ snprintf( tmp, sizeof(tmp), "Verb# %d", i );
+ tmp[sizeof(tmp)-1] = 0;
+ std::string descr(tmp);
+
+ Inkscape::Verb* verb = Inkscape::Verb::get(i);
+ TSM_ASSERT( descr, verb );
+ if ( verb )
+ {
+ TSM_ASSERT_EQUALS( descr, verb->get_code(), static_cast<unsigned int>(i) );
+
+ if ( i != static_cast<int>(SP_VERB_INVALID) )
+ {
+ TSM_ASSERT( descr, verb->get_id() );
+ TSM_ASSERT( descr, verb->get_name() );
+
+ Inkscape::Verb* bounced = verb->getbyid( verb->get_id() );
+ // TODO - put this back once verbs are fixed
+ //TSM_ASSERT( descr, bounced );
+ if ( bounced )
+ {
+ TSM_ASSERT_EQUALS( descr, bounced->get_code(), static_cast<unsigned int>(i) );
+ }
+ else
+ {
+ TS_FAIL( std::string("Unable to getbyid() for ") + descr + std::string(" ID: '") + std::string(verb->get_id()) + std::string("'") );
+ }
+ }
+ else
+ {
+ TSM_ASSERT( std::string("SP_VERB_INVALID"), !verb->get_id() );
+ TSM_ASSERT( std::string("SP_VERB_INVALID"), !verb->get_name() );
+ }
+ }
+ }
+ }
+
+};
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :