summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlex Valavanis <valavanisalex@gmail.com>2016-08-30 22:19:16 +0000
committerAlexander Valavanis <valavanisalex@gmail.com>2016-08-30 22:19:16 +0000
commitd311eb86bbec90bd99244cf04f0f6145b3a80828 (patch)
treefd800e2ef8e26f890a39917fdc7150be94dd6b75 /src
parent[Bug #1447971] User palettes not available if all shared system palettes are ... (diff)
downloadinkscape-d311eb86bbec90bd99244cf04f0f6145b3a80828.tar.gz
inkscape-d311eb86bbec90bd99244cf04f0f6145b3a80828.zip
Drop unused cxxtest fork in favour of Googletest
Fixed bugs: - https://launchpad.net/bugs/1094771 (bzr r15096)
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt15
-rw-r--r--src/attributes-test.h611
-rw-r--r--src/color-profile-test.h150
-rw-r--r--src/cxxtest-template.tpl13
-rw-r--r--src/dir-util-test.h56
-rw-r--r--src/extract-uri-test.h88
-rw-r--r--src/marker-test.h39
-rw-r--r--src/mod360-test.h56
-rw-r--r--src/object-test.h234
-rw-r--r--src/preferences-test.h136
-rw-r--r--src/round-test.h91
-rw-r--r--src/sp-gradient-test.h161
-rw-r--r--src/sp-style-elem-test.h166
-rw-r--r--src/style-test.h537
-rw-r--r--src/test-helpers.h66
-rw-r--r--src/uri-test.h90
-rw-r--r--src/verbs-test.h86
17 files changed, 0 insertions, 2595 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 4ba738635..9928f9694 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -112,7 +112,6 @@ set(sp_SRC
sp-glyph.h
sp-gradient-reference.h
sp-gradient-spread.h
- sp-gradient-test.h
sp-gradient-units.h
sp-gradient-vector.h
sp-gradient.h
@@ -160,7 +159,6 @@ set(sp_SRC
sp-star.h
sp-stop.h
sp-string.h
- sp-style-elem-test.h
sp-style-elem.h
sp-switch.h
sp-symbol.h
@@ -278,7 +276,6 @@ set(inkscape_SRC
MultiPrinter.h
PylogFormatter.h
TRPIFormatter.h
- attributes-test.h
attributes.h
axis-manip.h
bad-uri-exception.h
@@ -287,7 +284,6 @@ set(inkscape_SRC
cms-color-types.h
cms-system.h
color-profile-cms-fns.h
- color-profile-test.h
color-profile.h
color-rgba.h
color.h
@@ -302,7 +298,6 @@ set(inkscape_SRC
desktop-style.h
desktop.h
device-manager.h
- dir-util-test.h
dir-util.h
document-private.h
document-subset.h
@@ -312,7 +307,6 @@ set(inkscape_SRC
enums.h
event-log.h
event.h
- extract-uri-test.h
extract-uri.h
file.h
fill-or-stroke.h
@@ -343,26 +337,22 @@ set(inkscape_SRC
line-snapper.h
macros.h
main-cmdlineact.h
- marker-test.h
media.h
menus-skeleton.h
message-context.h
message-stack.h
message.h
- mod360-test.h
mod360.h
number-opt-number.h
object-hierarchy.h
object-set.h
object-snapper.h
- object-test.h
path-chemistry.h
path-prefix.h
persp3d-reference.h
persp3d.h
perspective-line.h
preferences-skeleton.h
- preferences-test.h
preferences.h
prefix.h
print.h
@@ -374,7 +364,6 @@ set(inkscape_SRC
removeoverlap.h
require-config.h
resource-manager.h
- round-test.h
round.h
rubberband.h
satisfied-guide-cns.h
@@ -398,13 +387,11 @@ set(inkscape_SRC
strneq.h
style-enums.h
style-internal.h
- style-test.h
style.h
svg-profile.h
svg-view-widget.h
svg-view.h
syseq.h
- test-helpers.h
text-chemistry.h
text-editing.h
text-tag-attributes.h
@@ -413,10 +400,8 @@ set(inkscape_SRC
undo-stack-observer.h
unicoderange.h
uri-references.h
- uri-test.h
uri.h
vanishing-point.h
- verbs-test.h
verbs.h
version.h
)
diff --git a/src/attributes-test.h b/src/attributes-test.h
deleted file mode 100644
index bfb67064b..000000000
--- a/src/attributes-test.h
+++ /dev/null
@@ -1,611 +0,0 @@
-
-#ifndef SEEN_ATTRIBUTES_TEST_H
-#define SEEN_ATTRIBUTES_TEST_H
-
-#include <cxxtest/TestSuite.h>
-
-#include <vector>
-#include <glib.h>
-#include <glib/gprintf.h>
-#include "attributes.h"
-#include "streq.h"
-
-class AttributesTest : public CxxTest::TestSuite
-{
-public:
-
- AttributesTest()
- {
- }
- virtual ~AttributesTest() {}
-
-// createSuite and destroySuite get us per-suite setup and teardown
-// without us having to worry about static initialization order, etc.
- static AttributesTest *createSuite() { return new AttributesTest(); }
- static void destroySuite( AttributesTest *suite ) { delete suite; }
-
-
- void testAttributes()
- {
-/* Extracted mechanically from http://www.w3.org/TR/SVG11/attindex.html:
-
- tidy -wrap 999 -asxml < attindex.html 2>/dev/null |
- tr -d \\n |
- sed 's,<tr>,@,g' |
- tr @ \\n |
- sed 's,</td>.*,,;s,^<td>,,;1,/^%/d;/^%/d;s,^, {",;s/$/", false},/' |
- uniq
-
- attindex.html lacks attributeName, begin, additive, font, marker;
- I've added these manually.
-
- SVG 2: white-space, shape-inside, shape-outside, shape-padding, shape-margin
- SVG 2: text-decoration-fill, text-decoration-stroke
- SVG 2: solid-color, solid-opacity
- SVG 2: Hatches and Meshes, radial gradient 'fr'
- CSS 3: text-orientation
- CSS 3: font-variant-xxx, font-feature-settings
-*/
-struct {char const *attr; bool supported;} const all_attrs[] = {
- {"attributeName", true},
- {"begin", true},
- {"additive", true},
- {"font", true},
- {"-inkscape-font-specification", true}, // TODO look into this attribute's name
- {"marker", true},
- {"line-height", true},
-
- {"accent-height", true},
- {"accumulate", true},
- {"alignment-baseline", true},
- {"alphabetic", true},
- {"amplitude", true},
- {"animate", false},
- {"arabic-form", true},
- {"ascent", true},
- {"attributeType", true},
- {"azimuth", true},
- {"baseFrequency", true},
- {"baseline-shift", true},
- {"baseProfile", false},
- {"bbox", true},
- {"bias", true},
- {"by", true},
- {"calcMode", true},
- {"cap-height", true},
- {"class", false},
- {"clip", true},
- {"clip-path", true},
- {"clip-rule", true},
- {"clipPathUnits", true},
- {"color", true},
- {"color-interpolation", true},
- {"color-interpolation-filters", true},
- {"color-profile", true},
- {"color-rendering", true},
- {"contentScriptType", false},
- {"contentStyleType", false},
- {"cursor", true},
- {"cx", true},
- {"cy", true},
- {"d", true},
- {"descent", true},
- {"diffuseConstant", true},
- {"direction", true},
- {"display", true},
- {"divisor", true},
- {"dominant-baseline", true},
- {"dur", true},
- {"dx", true},
- {"dy", true},
- {"edgeMode", true},
- {"elevation", true},
- {"enable-background", true},
- {"end", true},
- {"exponent", true},
- {"externalResourcesRequired", false},
- {"fill", true},
- {"fill-opacity", true},
- {"fill-rule", true},
- {"filter", true},
- {"filterRes", true},
- {"filterUnits", true},
- {"flood-color", true},
- {"flood-opacity", true},
- {"font-family", true},
- {"font-feature-settings", true},
- {"font-size", true},
- {"font-size-adjust", true},
- {"font-stretch", true},
- {"font-style", true},
- {"font-variant", true},
- {"font-variant-ligatures", true},
- {"font-variant-position", true},
- {"font-variant-caps", true},
- {"font-variant-numeric", true},
- {"font-variant-east-asian", true},
- {"font-variant-alternates", true},
- {"font-weight", true},
- {"format", false},
- {"from", true},
- {"fx", true},
- {"fy", true},
- {"fr", true},
- {"g1", true},
- {"g2", true},
- {"glyph-name", true},
- {"glyph-orientation-horizontal", true},
- {"glyph-orientation-vertical", true},
- {"glyphRef", false},
- {"gradientTransform", true},
- {"gradientUnits", true},
- {"hanging", true},
- {"height", true},
- {"horiz-adv-x", true},
- {"horiz-origin-x", true},
- {"horiz-origin-y", true},
- {"ideographic", true},
- {"image-rendering", true},
- {"in", true},
- {"in2", true},
- {"intercept", true},
- {"isolation", true},
- {"k", true},
- {"k1", true},
- {"k2", true},
- {"k3", true},
- {"k4", true},
- {"kernelMatrix", true},
- {"kernelUnitLength", true},
- {"kerning", true},
- {"keyPoints", false},
- {"keySplines", true},
- {"keyTimes", true},
- {"lang", true},
- {"lengthAdjust", true},
- {"letter-spacing", true},
- {"lighting-color", true},
- {"limitingConeAngle", true},
- {"local", true},
- {"marker-end", true},
- {"marker-mid", true},
- {"marker-start", true},
- {"markerHeight", true},
- {"markerUnits", true},
- {"markerWidth", true},
- {"mask", true},
- {"maskContentUnits", true},
- {"maskUnits", true},
- {"mathematical", true},
- {"max", true},
- {"media", false},
- {"method", false},
- {"min", true},
- {"mix-blend-mode", true},
- {"mode", true},
- {"name", true},
- {"numOctaves", true},
- {"offset", true},
- {"onabort", false},
- {"onactivate", false},
- {"onbegin", false},
- {"onclick", false},
- {"onend", false},
- {"onerror", false},
- {"onfocusin", false},
- {"onfocusout", false},
- {"onload", true},
- {"onmousedown", false},
- {"onmousemove", false},
- {"onmouseout", false},
- {"onmouseover", false},
- {"onmouseup", false},
- {"onrepeat", false},
- {"onresize", false},
- {"onscroll", false},
- {"onunload", false},
- {"onzoom", false},
- {"opacity", true},
- {"operator", true},
- {"order", true},
- {"orient", true},
- {"orientation", true},
- {"origin", false},
- {"overflow", true},
- {"overline-position", true},
- {"overline-thickness", true},
- {"paint-order", true},
- {"panose-1", true},
- {"path", true},
- {"pathLength", false},
- {"patternContentUnits", true},
- {"patternTransform", true},
- {"patternUnits", true},
- {"pointer-events", true},
- {"points", true},
- {"pointsAtX", true},
- {"pointsAtY", true},
- {"pointsAtZ", true},
- {"preserveAlpha", true},
- {"preserveAspectRatio", true},
- {"primitiveUnits", true},
- {"r", true},
- {"radius", true},
- {"refX", true},
- {"refY", true},
- {"rendering-intent", true},
- {"repeatCount", true},
- {"repeatDur", true},
- {"requiredFeatures", true},
- {"requiredExtensions", true},
- {"restart", true},
- {"result", true},
- {"rotate", true},
- {"rx", true},
- {"ry", true},
- {"scale", true},
- {"seed", true},
- {"shape-inside", true},
- {"shape-margin", true},
- {"shape-outside", true},
- {"shape-padding", true},
- {"shape-rendering", true},
- {"slope", true},
- {"spacing", false},
- {"specularConstant", true},
- {"specularExponent", true},
- {"spreadMethod", true},
- {"startOffset", true},
- {"stdDeviation", true},
- {"stemh", true},
- {"stemv", true},
- {"stitchTiles", true},
- {"stop-color", true},
- {"stop-opacity", true},
- {"strikethrough-position", true},
- {"strikethrough-thickness", true},
- {"stroke", true},
- {"stroke-dasharray", true},
- {"stroke-dashoffset", true},
- {"stroke-linecap", true},
- {"stroke-linejoin", true},
- {"stroke-miterlimit", true},
- {"stroke-opacity", true},
- {"stroke-width", true},
- {"style", true},
- {"surfaceScale", true},
- {"systemLanguage", true},
- {"tableValues", true},
- {"target", true},
- {"targetX", true},
- {"targetY", true},
- {"text-align", true},
- {"text-anchor", true},
- {"text-decoration", true},
- {"text-decoration-line", true},
- {"text-decoration-style", true},
- {"text-decoration-color", true},
- {"text-decoration-fill", true},
- {"text-decoration-stroke", true},
- {"text-indent", true},
- {"text-rendering", true},
- {"text-transform", true},
- {"textLength", true},
- {"title", false},
- {"to", true},
- {"transform", true},
- {"type", true},
- {"u1", true},
- {"u2", true},
- {"underline-position", true},
- {"underline-thickness", true},
- {"unicode", true},
- {"unicode-bidi", true},
- {"unicode-range", true},
- {"units-per-em", true},
- {"v-alphabetic", true},
- {"v-hanging", true},
- {"v-ideographic", true},
- {"v-mathematical", true},
- {"values", true},
- {"version", true},
- {"vert-adv-y", true},
- {"vert-origin-x", true},
- {"vert-origin-y", true},
- {"viewBox", true},
- {"viewTarget", false},
- {"visibility", true},
- {"white-space", true},
- {"width", true},
- {"widths", true},
- {"word-spacing", true},
- {"writing-mode", true},
- {"text-orientation", true},
- {"x", true},
- {"x-height", true},
- {"x1", true},
- {"x2", true},
- {"xChannelSelector", true},
- {"xlink:actuate", true},
- {"xlink:arcrole", true},
- {"xlink:href", true},
- {"xlink:role", true},
- {"xlink:show", true},
- {"xlink:title", true},
- {"xlink:type", true},
- {"xml:base", false},
- {"xml:space", true},
- {"xmlns", false},
- {"xmlns:xlink", false},
- {"y", true},
- {"y1", true},
- {"y2", true},
- {"yChannelSelector", true},
- {"z", true},
- {"zoomAndPan", false},
-
- /* Extra attributes. */
- {"id", true},
- {"sodipodi:docname", true},
- {"sodipodi:insensitive", true},
- {"sodipodi:type", true},
- {"inkscape:collect", true},
- {"inkscape:document-units", true},
- {"inkscape:label", true},
- {"inkscape:groupmode", true},
- {"inkscape:version", true},
- {"inkscape:object-paths", true},
-
- {"inkscape:original-d", true},
- {"inkscape:pageopacity", true},
- {"inkscape:pageshadow", true},
- {"inkscape:path-effect", true},
-
- // SPItem
- {"inkscape:transform-center-x", true},
- {"inkscape:transform-center-y", true},
- {"inkscape:highlight-color", true},
-
- // Measure tool
- {"inkscape:measure-start", true},
- {"inkscape:measure-end", true},
-
- // Spray tool
- {"inkscape:spray-origin", true},
-
- // Connector tool
- {"inkscape:connector-type", true},
- {"inkscape:connection-start", true},
- {"inkscape:connection-end", true},
- {"inkscape:connection-points", true},
- {"inkscape:connection-start-point", true},
- {"inkscape:connection-end-point", true},
- {"inkscape:connector-curvature", true},
- {"inkscape:connector-avoid", true},
- {"inkscape:connector-spacing", true},
-
- // Ellipse, Spiral, Star
- {"sodipodi:cx", true},
- {"sodipodi:cy", true},
- {"sodipodi:rx", true},
- {"sodipodi:ry", true},
-
- // Box tool
- {"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},
-
- // Star tool
- {"sodipodi:start", true},
- {"sodipodi:end", true},
- {"sodipodi:open", true},
- {"sodipodi:sides", true},
- {"sodipodi:r1", true},
- {"sodipodi:r2", true},
- {"sodipodi:arg1", true},
- {"sodipodi:arg2", true},
- {"inkscape:flatsided", true},
- {"inkscape:rounded", true},
- {"inkscape:randomized", true},
- {"sodipodi:expansion", true},
- {"sodipodi:revolution", true},
- {"sodipodi:radius", true},
- {"sodipodi:argument", true},
- {"sodipodi:t0", true},
- {"sodipodi:original", true},
- {"inkscape:original", true},
- {"inkscape:href", true},
- {"inkscape:radius", true},
- {"sodipodi:role", true},
- {"sodipodi:linespacing", true},
- {"inkscape:srcNoMarkup", true},
- {"inkscape:srcPango", true},
- {"inkscape:dstShape", true},
- {"inkscape:dstPath", true},
- {"inkscape:dstBox", true},
- {"inkscape:dstColumn", true},
- {"inkscape:excludeShape", true},
- {"inkscape:layoutOptions", true},
- {"osb:paint", true},
-
- /* SPSolidColor" */
- {"solid-color", true},
- {"solid-opacity", true},
-
- /* SPMeshPatch */
- {"tensor", true},
-
- /* SPHash */
- {"hatchUnits", true},
- {"hatchContentUnits", true},
- {"hatchTransform", true},
- {"pitch", true},
-
- /* SPNamedView */
- {"fit-margin-top", true},
- {"fit-margin-left", true},
- {"fit-margin-right", true},
- {"fit-margin-bottom", true},
- {"units", true},
- {"viewonly", true},
- {"showgrid", true},
-// {"gridtype", true},
- {"showguides", true},
-// {"inkscape:lockguides", false}, //not sure about uncomment
- {"gridtolerance", true},
- {"guidetolerance", true},
- {"objecttolerance", true},
-/* {"gridoriginx", true},
- {"gridoriginy", true},
- {"gridspacingx", true},
- {"gridspacingy", true},
- {"gridanglex", true},
- {"gridanglez", true},
- {"gridcolor", true},
- {"gridopacity", true},
- {"gridempcolor", true},
- {"gridempopacity", true},
- {"gridempspacing", true}, */
- {"guidecolor", true},
- {"guideopacity", true},
- {"guidehicolor", true},
- {"guidehiopacity", true},
- {"showborder", true},
- {"inkscape:showpageshadow", true},
- {"borderlayer", true},
- {"bordercolor", true},
- {"borderopacity", true},
- {"pagecolor", true},
-
- {"inkscape:zoom", true},
- {"inkscape:cx", true},
- {"inkscape:cy", true},
- {"inkscape:window-width", true},
- {"inkscape:window-height", true},
- {"inkscape:window-x", true},
- {"inkscape:window-y", true},
- {"inkscape:window-maximized", true},
- {"inkscape:current-layer", true},
- {"inkscape:pagecheckerboard", true},
-
- /* SPGuide */
- {"position", true},
- {"inkscape:color", true},
- {"inkscape:lockguides", true},
- {"inkscape:locked", true},
-
- /* Snapping */
- {"inkscape:snap-perpendicular", true},
- {"inkscape:snap-tangential", true},
- {"inkscape:snap-path-clip", true},
- {"inkscape:snap-path-mask", 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-others", true},
- {"inkscape:snap-from-guide", true},
- {"inkscape:snap-center", true},
- {"inkscape:snap-smooth-nodes", true},
- {"inkscape:snap-midpoints", true},
- {"inkscape:snap-object-midpoints", true},
- {"inkscape:snap-text-baseline", true},
- {"inkscape:snap-bbox-edge-midpoints", true},
- {"inkscape:snap-bbox-midpoints", true},
- {"inkscape:snap-grids", true},
- {"inkscape:snap-to-guides", true},
- {"inkscape:snap-intersection-paths", true},
-
- /* SPTag */
- {"inkscape:expanded", true}
-};
-
-
-
- std::vector<bool> ids;
- ids.reserve(256);
-
- for (unsigned i = 0; i < G_N_ELEMENTS(all_attrs); ++i) {
- char const *const attr_str = all_attrs[i].attr;
- unsigned const id = sp_attribute_lookup(attr_str);
- bool const recognized(id);
- TSM_ASSERT_EQUALS( std::string(all_attrs[i].attr), recognized, all_attrs[i].supported );
- if (recognized) {
- if (ids.size() <= id) {
- ids.resize(id + 1);
- }
- TS_ASSERT(!ids[id]);
- ids[id] = true;
-
- unsigned char const *reverse_ustr = sp_attribute_name(id);
- char const *reverse_str = reinterpret_cast<char const *>(reverse_ustr);
- TS_ASSERT(streq(reverse_str, attr_str));
- }
- }
-
- /* Test for any attributes that this test program doesn't know about.
- *
- * If any are found, then:
- *
- * If it is in the `inkscape:' namespace then simply add it to all_attrs with
- * `true' as the second field (`supported').
- *
- * If it is in the `sodipodi:' namespace then check the spelling against sodipodi
- * sources. If you don't have sodipodi sources, then don't add it: leave to someone
- * else.
- *
- * Otherwise, it's probably a bug: ~all SVG 1.1 attributes should already be
- * in the all_attrs table. However, the comment above all_attrs does mention
- * some things missing from attindex.html, so there may be more. Check the SVG
- * spec. Another possibility is that the attribute is new in SVG 1.2. In this case,
- * check the spelling against the [draft] SVG 1.2 spec before adding to all_attrs.
- * (If you can't be bothered checking the spec, then don't update all_attrs.)
- *
- * If the attribute isn't in either SVG 1.1 or 1.2 then it's probably a mistake
- * for it not to be in the inkscape namespace. (Not sure about attributes used only
- * on elements in the inkscape namespace though.)
- *
- * In any case, make sure that the attribute's source is documented accordingly.
- */
- bool found = false;
- unsigned const n_ids = ids.size();
- for (unsigned id = 1; id < n_ids; ++id) {
- if (!ids[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 ( unsigned int index = 1; index < n_ids; index++ ) {
- guchar const* name = sp_attribute_name(index);
- unsigned int 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++
- 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/src/color-profile-test.h b/src/color-profile-test.h
deleted file mode 100644
index 4276eb774..000000000
--- a/src/color-profile-test.h
+++ /dev/null
@@ -1,150 +0,0 @@
-
-#ifndef SEEN_COLOR_PROFILE_TEST_H
-#define SEEN_COLOR_PROFILE_TEST_H
-
-#include <cxxtest/TestSuite.h>
-#include <cassert>
-
-#include "test-helpers.h"
-
-
-#include "color-profile.h"
-#include "cms-system.h"
-
-class ColorProfileTest : public CxxTest::TestSuite
-{
-public:
- SPDocument* _doc;
-
- ColorProfileTest() :
- _doc(0)
- {
- }
-
- virtual ~ColorProfileTest()
- {
- if ( _doc )
- {
- _doc->doUnref();
- }
- }
-
- static void createSuiteSubclass( ColorProfileTest*& dst )
- {
- Inkscape::ColorProfile *prof = new Inkscape::ColorProfile();
- if ( prof ) {
- if ( prof->rendering_intent == (guint)Inkscape::RENDERING_INTENT_UNKNOWN ) {
- TS_ASSERT_EQUALS( prof->rendering_intent, (guint)Inkscape::RENDERING_INTENT_UNKNOWN );
- dst = new ColorProfileTest();
- }
- delete prof;
- }
- }
-
-// createSuite and destroySuite get us per-suite setup and teardown
-// without us having to worry about static initialization order, etc.
- static ColorProfileTest *createSuite()
- {
- ColorProfileTest* suite = Inkscape::createSuiteAndDocument<ColorProfileTest>( createSuiteSubclass );
- return suite;
- }
-
- static void destroySuite( ColorProfileTest *suite )
- {
- delete suite;
- }
-
- // ---------------------------------------------------------------
- // ---------------------------------------------------------------
- // ---------------------------------------------------------------
-
- void testSetRenderingIntent()
- {
- struct {
- gchar const *attr;
- guint intVal;
- }
- const cases[] = {
- {"auto", (guint)Inkscape::RENDERING_INTENT_AUTO},
- {"perceptual", (guint)Inkscape::RENDERING_INTENT_PERCEPTUAL},
- {"relative-colorimetric", (guint)Inkscape::RENDERING_INTENT_RELATIVE_COLORIMETRIC},
- {"saturation", (guint)Inkscape::RENDERING_INTENT_SATURATION},
- {"absolute-colorimetric", (guint)Inkscape::RENDERING_INTENT_ABSOLUTE_COLORIMETRIC},
- {"something-else", (guint)Inkscape::RENDERING_INTENT_UNKNOWN},
- {"auto2", (guint)Inkscape::RENDERING_INTENT_UNKNOWN},
- };
-
- Inkscape::ColorProfile *prof = new Inkscape::ColorProfile();
- TS_ASSERT( prof );
- SP_OBJECT(prof)->document = _doc;
-
- for ( size_t i = 0; i < G_N_ELEMENTS( cases ); i++ ) {
- std::string descr(cases[i].attr);
- SP_OBJECT(prof)->setKeyValue( SP_ATTR_RENDERING_INTENT, cases[i].attr);
- TSM_ASSERT_EQUALS( descr, prof->rendering_intent, (guint)cases[i].intVal );
- }
-
- delete prof;
- }
-
- void testSetLocal()
- {
- gchar const* cases[] = {
- "local",
- "something",
- };
-
- Inkscape::ColorProfile *prof = new Inkscape::ColorProfile();
- TS_ASSERT( prof );
- SP_OBJECT(prof)->document = _doc;
-
- for ( size_t i = 0; i < G_N_ELEMENTS( cases ); i++ ) {
- SP_OBJECT(prof)->setKeyValue( SP_ATTR_LOCAL, cases[i]);
- TS_ASSERT( prof->local );
- if ( prof->local ) {
- TS_ASSERT_EQUALS( std::string(prof->local), std::string(cases[i]) );
- }
- }
- SP_OBJECT(prof)->setKeyValue( SP_ATTR_LOCAL, NULL);
- TS_ASSERT_EQUALS( prof->local, (gchar*)0 );
-
- delete prof;
- }
-
- void testSetName()
- {
- gchar const* cases[] = {
- "name",
- "something",
- };
-
- Inkscape::ColorProfile *prof = new Inkscape::ColorProfile();
- TS_ASSERT( prof );
- SP_OBJECT(prof)->document = _doc;
-
- for ( size_t i = 0; i < G_N_ELEMENTS( cases ); i++ ) {
- SP_OBJECT(prof)->setKeyValue( SP_ATTR_NAME, cases[i]);
- TS_ASSERT( prof->name );
- if ( prof->name ) {
- TS_ASSERT_EQUALS( std::string(prof->name), std::string(cases[i]) );
- }
- }
- SP_OBJECT(prof)->setKeyValue( SP_ATTR_NAME, NULL);
- TS_ASSERT_EQUALS( prof->name, (gchar*)0 );
-
- delete prof;
- }
-};
-
-#endif // SEEN_COLOR_PROFILE_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/src/cxxtest-template.tpl b/src/cxxtest-template.tpl
deleted file mode 100644
index df20bebfd..000000000
--- a/src/cxxtest-template.tpl
+++ /dev/null
@@ -1,13 +0,0 @@
-// -*- C++ -*-
-//
-
-#include "MultiPrinter.h"
-
-int main( int argc, char *argv[] )
-{
- (void)argc;
- return CxxTest::MultiPrinter( argv[0] ).run();
-}
-
-// The CxxTest "world"
-<CxxTest world>
diff --git a/src/dir-util-test.h b/src/dir-util-test.h
deleted file mode 100644
index 735f0174e..000000000
--- a/src/dir-util-test.h
+++ /dev/null
@@ -1,56 +0,0 @@
-
-#ifndef SEEN_DIR_UTIL_TEST_H
-#define SEEN_DIR_UTIL_TEST_H
-
-#include <cxxtest/TestSuite.h>
-
-#include "dir-util.h"
-
-class DirUtilTest : public CxxTest::TestSuite
-{
-public:
- void testBase()
- {
- char const* cases[][3] = {
-#if defined(WIN32) || defined(__WIN32__)
- {"\\foo\\bar", "\\foo", "bar"},
- {"\\foo\\barney", "\\foo\\bar", "\\foo\\barney"},
- {"\\foo\\bar\\baz", "\\foo\\", "bar\\baz"},
- {"\\foo\\bar\\baz", "\\", "foo\\bar\\baz"},
- {"\\foo\\bar\\baz", "\\foo\\qux", "\\foo\\bar\\baz"},
-#else
- {"/foo/bar", "/foo", "bar"},
- {"/foo/barney", "/foo/bar", "/foo/barney"},
- {"/foo/bar/baz", "/foo/", "bar/baz"},
- {"/foo/bar/baz", "/", "foo/bar/baz"},
- {"/foo/bar/baz", "/foo/qux", "/foo/bar/baz"},
-#endif
- };
-
- for ( size_t i = 0; i < G_N_ELEMENTS(cases); i++ )
- {
- if ( cases[i][0] && cases[i][1] ) { // std::string can't use null.
- std::string result = sp_relative_path_from_path( cases[i][0], cases[i][1] );
- TS_ASSERT( !result.empty() );
- if ( !result.empty() )
- {
- TS_ASSERT_EQUALS( result, std::string(cases[i][2]) );
- }
- }
- }
- }
-
-};
-
-#endif // SEEN_DIR_UTIL_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/src/extract-uri-test.h b/src/extract-uri-test.h
deleted file mode 100644
index e795960a9..000000000
--- a/src/extract-uri-test.h
+++ /dev/null
@@ -1,88 +0,0 @@
-
-#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/src/marker-test.h b/src/marker-test.h
deleted file mode 100644
index bf7e1040a..000000000
--- a/src/marker-test.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/** @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/src/mod360-test.h b/src/mod360-test.h
deleted file mode 100644
index 932361eb3..000000000
--- a/src/mod360-test.h
+++ /dev/null
@@ -1,56 +0,0 @@
-
-#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/src/object-test.h b/src/object-test.h
deleted file mode 100644
index 0af823684..000000000
--- a/src/object-test.h
+++ /dev/null
@@ -1,234 +0,0 @@
-#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/src/preferences-test.h b/src/preferences-test.h
deleted file mode 100644
index 92cb14247..000000000
--- a/src/preferences-test.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/** @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/src/round-test.h b/src/round-test.h
deleted file mode 100644
index 8e9ca69e0..000000000
--- a/src/round-test.h
+++ /dev/null
@@ -1,91 +0,0 @@
-
-#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/src/sp-gradient-test.h b/src/sp-gradient-test.h
deleted file mode 100644
index 578d0c5c0..000000000
--- a/src/sp-gradient-test.h
+++ /dev/null
@@ -1,161 +0,0 @@
-#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/src/sp-style-elem-test.h b/src/sp-style-elem-test.h
deleted file mode 100644
index 6f65a48ea..000000000
--- a/src/sp-style-elem-test.h
+++ /dev/null
@@ -1,166 +0,0 @@
-#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/src/style-test.h b/src/style-test.h
deleted file mode 100644
index c6bb665e0..000000000
--- a/src/style-test.h
+++ /dev/null
@@ -1,537 +0,0 @@
-#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/src/test-helpers.h b/src/test-helpers.h
deleted file mode 100644
index d30449ebb..000000000
--- a/src/test-helpers.h
+++ /dev/null
@@ -1,66 +0,0 @@
-#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/src/uri-test.h b/src/uri-test.h
deleted file mode 100644
index 2a4cdab46..000000000
--- a/src/uri-test.h
+++ /dev/null
@@ -1,90 +0,0 @@
-
-#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/src/verbs-test.h b/src/verbs-test.h
deleted file mode 100644
index 04a0b80c0..000000000
--- a/src/verbs-test.h
+++ /dev/null
@@ -1,86 +0,0 @@
-
-
-#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 :