From: Jon A. Cruz Date: Tue, 14 Dec 2010 09:12:46 +0000 (-0800) Subject: Unit test cleanup. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=195bd1f8e749e0fb4c7e609618cd6b9a9a2b1cef;p=inkscape.git Unit test cleanup. --- diff --git a/src/sp-gradient-test.h b/src/sp-gradient-test.h index 2a061595e..5ab08467d 100644 --- a/src/sp-gradient-test.h +++ b/src/sp-gradient-test.h @@ -74,7 +74,7 @@ public: SP_OBJECT(gr)->document = _doc; SP_OBJECT(gr)->setKeyValue( SP_ATTR_GRADIENTTRANSFORM, "matrix(0, 1, -1, 0, 0, 0)"); - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(_doc); + 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); { diff --git a/src/sp-style-elem-test.h b/src/sp-style-elem-test.h index 53362d3e3..7021be13d 100644 --- a/src/sp-style-elem-test.h +++ b/src/sp-style-elem-test.h @@ -73,8 +73,8 @@ public: void testWrite() { TS_ASSERT( _doc ); - TS_ASSERT( sp_document_repr_doc(_doc) ); - if ( !sp_document_repr_doc(_doc) ) { + TS_ASSERT( _doc->getReprDoc() ); + if ( !_doc->getReprDoc() ) { return; // evil early return } @@ -82,8 +82,8 @@ public: SP_OBJECT(style_elem)->document = _doc; SP_OBJECT(style_elem)->setKeyValue( SP_ATTR_TYPE, "text/css"); - Inkscape::XML::Node *repr = sp_document_repr_doc(_doc)->createElement("svg:style"); - SP_OBJECT(style_elem)->updateRepr(sp_document_repr_doc(_doc), repr, SP_OBJECT_WRITE_ALL); + 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 ); @@ -99,13 +99,13 @@ public: void testBuild() { TS_ASSERT( _doc ); - TS_ASSERT( sp_document_repr_doc(_doc) ); - if ( !sp_document_repr_doc(_doc) ) { + TS_ASSERT( _doc->getReprDoc() ); + if ( !_doc->getReprDoc() ) { return; // evil early return } SPStyleElem &style_elem = *SP_STYLE_ELEM(g_object_new(SP_TYPE_STYLE_ELEM, NULL)); - Inkscape::XML::Node *const repr = sp_document_repr_doc(_doc)->createElement("svg:style"); + 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 ); @@ -127,15 +127,15 @@ public: void testReadContent() { TS_ASSERT( _doc ); - TS_ASSERT( sp_document_repr_doc(_doc) ); - if ( !sp_document_repr_doc(_doc) ) { + TS_ASSERT( _doc->getReprDoc() ); + if ( !_doc->getReprDoc() ) { return; // evil early return } SPStyleElem &style_elem = *SP_STYLE_ELEM(g_object_new(SP_TYPE_STYLE_ELEM, NULL)); - Inkscape::XML::Node *const repr = sp_document_repr_doc(_doc)->createElement("svg:style"); + Inkscape::XML::Node *const repr = _doc->getReprDoc()->createElement("svg:style"); repr->setAttribute("type", "text/css"); - Inkscape::XML::Node *const content_repr = sp_document_repr_doc(_doc)->createTextNode(".myclass { }"); + 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 ); diff --git a/src/svg/svg-path-geom-test.h b/src/svg/svg-path-geom-test.h index 239a975f6..5735b6017 100644 --- a/src/svg/svg-path-geom-test.h +++ b/src/svg/svg-path-geom-test.h @@ -407,7 +407,7 @@ private: bool bpathEqual(Geom::PathVector const &a, Geom::PathVector const &b, double eps = 1e-16) { if (a.size() != b.size()) { char temp[100]; - sprintf(temp, "PathVectors not the same size: %u != %u", a.size(), b.size()); + sprintf(temp, "PathVectors not the same size: %u != %u", static_cast(a.size()),static_cast( b.size())); TS_FAIL(temp); return false; } @@ -416,19 +416,19 @@ private: Geom::Path const &pb = b[i]; if (pa.closed() && !pb.closed()) { char temp[100]; - sprintf(temp, "Left subpath is closed, right subpath is open. Subpath: %u", i); + sprintf(temp, "Left subpath is closed, right subpath is open. Subpath: %u", static_cast(i)); TS_FAIL(temp); return false; } if (!pa.closed() && pb.closed()) { char temp[100]; - sprintf(temp, "Right subpath is closed, left subpath is open. Subpath: %u", i); + sprintf(temp, "Right subpath is closed, left subpath is open. Subpath: %u", static_cast(i)); TS_FAIL(temp); return false; } if (pa.size() != pb.size()) { char temp[100]; - sprintf(temp, "Not the same number of segments: %u != %u, subpath: %u", pa.size(), pb.size(), i); + sprintf(temp, "Not the same number of segments: %u != %u, subpath: %u", static_cast(pa.size()), static_cast(pb.size()), static_cast(i)); TS_FAIL(temp); return false; } @@ -442,13 +442,13 @@ private: Geom::LineSegment const *lb = dynamic_cast(cb); if (!Geom::are_near((*la)[0],(*lb)[0], eps)) { char temp[200]; - sprintf(temp, "Different start of segment: (%g,%g) != (%g,%g), subpath: %u, segment: %u", (*la)[0][Geom::X], (*la)[0][Geom::Y], (*lb)[0][Geom::X], (*lb)[0][Geom::Y], i, j); + sprintf(temp, "Different start of segment: (%g,%g) != (%g,%g), subpath: %u, segment: %u", (*la)[0][Geom::X], (*la)[0][Geom::Y], (*lb)[0][Geom::X], (*lb)[0][Geom::Y], static_cast(i), static_cast(j)); TS_FAIL(temp); return false; } if (!Geom::are_near((*la)[1],(*lb)[1], eps)) { char temp[200]; - sprintf(temp, "Different end of segment: (%g,%g) != (%g,%g), subpath: %u, segment: %u", (*la)[1][Geom::X], (*la)[1][Geom::Y], (*lb)[1][Geom::X], (*lb)[1][Geom::Y], i, j); + sprintf(temp, "Different end of segment: (%g,%g) != (%g,%g), subpath: %u, segment: %u", (*la)[1][Geom::X], (*la)[1][Geom::Y], (*lb)[1][Geom::X], (*lb)[1][Geom::Y], static_cast(i), static_cast(j)); TS_FAIL(temp); return false; } @@ -458,13 +458,13 @@ private: Geom::HLineSegment const *lb = dynamic_cast(cb); if (!Geom::are_near((*la).initialPoint(),(*lb).initialPoint(), eps)) { char temp[200]; - sprintf(temp, "Different start of segment: (%g,%g) != (%g,%g), subpath: %u, segment: %u", (*la).initialPoint()[Geom::X], (*la).initialPoint()[Geom::Y], (*lb).initialPoint()[Geom::X], (*lb).initialPoint()[Geom::Y], i, j); + sprintf(temp, "Different start of segment: (%g,%g) != (%g,%g), subpath: %u, segment: %u", (*la).initialPoint()[Geom::X], (*la).initialPoint()[Geom::Y], (*lb).initialPoint()[Geom::X], (*lb).initialPoint()[Geom::Y], static_cast(i), static_cast(j)); TS_FAIL(temp); return false; } if (!Geom::are_near((*la).finalPoint(),(*lb).finalPoint(), eps)) { char temp[200]; - sprintf(temp, "Different end of segment: (%g,%g) != (%g,%g), subpath: %u, segment: %u", (*la).finalPoint()[Geom::X], (*la).finalPoint()[Geom::Y], (*lb).finalPoint()[Geom::X], (*lb).finalPoint()[Geom::Y], i, j); + sprintf(temp, "Different end of segment: (%g,%g) != (%g,%g), subpath: %u, segment: %u", (*la).finalPoint()[Geom::X], (*la).finalPoint()[Geom::Y], (*lb).finalPoint()[Geom::X], (*lb).finalPoint()[Geom::Y], static_cast(i), static_cast(j)); TS_FAIL(temp); return false; } @@ -474,13 +474,13 @@ private: Geom::VLineSegment const *lb = dynamic_cast(cb); if (!Geom::are_near((*la).initialPoint(),(*lb).initialPoint(), eps)) { char temp[200]; - sprintf(temp, "Different start of segment: (%g,%g) != (%g,%g), subpath: %u, segment: %u", (*la).initialPoint()[Geom::X], (*la).initialPoint()[Geom::Y], (*lb).initialPoint()[Geom::X], (*lb).initialPoint()[Geom::Y], i, j); + sprintf(temp, "Different start of segment: (%g,%g) != (%g,%g), subpath: %u, segment: %u", (*la).initialPoint()[Geom::X], (*la).initialPoint()[Geom::Y], (*lb).initialPoint()[Geom::X], (*lb).initialPoint()[Geom::Y], static_cast(i), static_cast(j)); TS_FAIL(temp); return false; } if (!Geom::are_near((*la).finalPoint(),(*lb).finalPoint(), eps)) { char temp[200]; - sprintf(temp, "Different end of segment: (%g,%g) != (%g,%g), subpath: %u, segment: %u", (*la).finalPoint()[Geom::X], (*la).finalPoint()[Geom::Y], (*lb).finalPoint()[Geom::X], (*lb).finalPoint()[Geom::Y], i, j); + sprintf(temp, "Different end of segment: (%g,%g) != (%g,%g), subpath: %u, segment: %u", (*la).finalPoint()[Geom::X], (*la).finalPoint()[Geom::Y], (*lb).finalPoint()[Geom::X], (*lb).finalPoint()[Geom::Y], static_cast(i), static_cast(j)); TS_FAIL(temp); return false; } @@ -490,25 +490,25 @@ private: Geom::CubicBezier const *lb = dynamic_cast(cb); if (!Geom::are_near((*la)[0],(*lb)[0], eps)) { char temp[200]; - sprintf(temp, "Different start of segment: (%g,%g) != (%g,%g), subpath: %u, segment: %u", (*la)[0][Geom::X], (*la)[0][Geom::Y], (*lb)[0][Geom::X], (*lb)[0][Geom::Y], i, j); + sprintf(temp, "Different start of segment: (%g,%g) != (%g,%g), subpath: %u, segment: %u", (*la)[0][Geom::X], (*la)[0][Geom::Y], (*lb)[0][Geom::X], (*lb)[0][Geom::Y], static_cast(i), static_cast(j)); TS_FAIL(temp); return false; } if (!Geom::are_near((*la)[1],(*lb)[1], eps)) { char temp[200]; - sprintf(temp, "Different 1st control point: (%g,%g) != (%g,%g), subpath: %u, segment: %u", (*la)[1][Geom::X], (*la)[1][Geom::Y], (*lb)[1][Geom::X], (*lb)[1][Geom::Y], i, j); + sprintf(temp, "Different 1st control point: (%g,%g) != (%g,%g), subpath: %u, segment: %u", (*la)[1][Geom::X], (*la)[1][Geom::Y], (*lb)[1][Geom::X], (*lb)[1][Geom::Y], static_cast(i), static_cast(j)); TS_FAIL(temp); return false; } if (!Geom::are_near((*la)[2],(*lb)[2], eps)) { char temp[200]; - sprintf(temp, "Different 2nd control point: (%g,%g) != (%g,%g), subpath: %u, segment: %u", (*la)[2][Geom::X], (*la)[2][Geom::Y], (*lb)[2][Geom::X], (*lb)[2][Geom::Y], i, j); + sprintf(temp, "Different 2nd control point: (%g,%g) != (%g,%g), subpath: %u, segment: %u", (*la)[2][Geom::X], (*la)[2][Geom::Y], (*lb)[2][Geom::X], (*lb)[2][Geom::Y], static_cast(i), static_cast(j)); TS_FAIL(temp); return false; } if (!Geom::are_near((*la)[3],(*lb)[3], eps)) { char temp[200]; - sprintf(temp, "Different end of segment: (%g,%g) != (%g,%g), subpath: %u, segment: %u", (*la)[3][Geom::X], (*la)[3][Geom::Y], (*lb)[3][Geom::X], (*lb)[3][Geom::Y], i, j); + sprintf(temp, "Different end of segment: (%g,%g) != (%g,%g), subpath: %u, segment: %u", (*la)[3][Geom::X], (*la)[3][Geom::Y], (*lb)[3][Geom::X], (*lb)[3][Geom::Y], static_cast(i), static_cast(j)); TS_FAIL(temp); return false; } @@ -516,7 +516,7 @@ private: else { char temp[200]; - sprintf(temp, "Unknown curve type: %s, subpath: %u, segment: %u", typeid(*ca).name(), i, j); + sprintf(temp, "Unknown curve type: %s, subpath: %u, segment: %u", typeid(*ca).name(), static_cast(i), static_cast(j)); TS_FAIL(temp); } } @@ -527,38 +527,38 @@ private: if (Geom::HLineSegment const *lb = dynamic_cast(cb)) { if (!Geom::are_near((*la).initialPoint(),(*lb).initialPoint(), eps)) { char temp[200]; - sprintf(temp, "Different start of segment: (%g,%g) != (%g,%g), subpath: %u, segment: %u", (*la).initialPoint()[Geom::X], (*la).initialPoint()[Geom::Y], (*lb).initialPoint()[Geom::X], (*lb).initialPoint()[Geom::Y], i, j); + sprintf(temp, "Different start of segment: (%g,%g) != (%g,%g), subpath: %u, segment: %u", (*la).initialPoint()[Geom::X], (*la).initialPoint()[Geom::Y], (*lb).initialPoint()[Geom::X], (*lb).initialPoint()[Geom::Y], static_cast(i), static_cast(j)); TS_FAIL(temp); return false; } if (!Geom::are_near((*la).finalPoint(),(*lb).finalPoint(), eps)) { char temp[200]; - sprintf(temp, "Different end of segment: (%g,%g) != (%g,%g), subpath: %u, segment: %u", (*la).finalPoint()[Geom::X], (*la).finalPoint()[Geom::Y], (*lb).finalPoint()[Geom::X], (*lb).finalPoint()[Geom::Y], i, j); + sprintf(temp, "Different end of segment: (%g,%g) != (%g,%g), subpath: %u, segment: %u", (*la).finalPoint()[Geom::X], (*la).finalPoint()[Geom::Y], (*lb).finalPoint()[Geom::X], (*lb).finalPoint()[Geom::Y], static_cast(i), static_cast(j)); TS_FAIL(temp); return false; } char temp[200]; - sprintf(temp, "A LineSegment and an HLineSegment have been considered equal. Subpath: %u, segment: %u", i, j); + sprintf(temp, "A LineSegment and an HLineSegment have been considered equal. Subpath: %u, segment: %u", static_cast(i), static_cast(j)); TS_TRACE(temp); } else if (Geom::VLineSegment const *lb = dynamic_cast(cb)) { if (!Geom::are_near((*la).initialPoint(),(*lb).initialPoint(), eps)) { char temp[200]; - sprintf(temp, "Different start of segment: (%g,%g) != (%g,%g), subpath: %u, segment: %u", (*la).initialPoint()[Geom::X], (*la).initialPoint()[Geom::Y], (*lb).initialPoint()[Geom::X], (*lb).initialPoint()[Geom::Y], i, j); + sprintf(temp, "Different start of segment: (%g,%g) != (%g,%g), subpath: %u, segment: %u", (*la).initialPoint()[Geom::X], (*la).initialPoint()[Geom::Y], (*lb).initialPoint()[Geom::X], (*lb).initialPoint()[Geom::Y], static_cast(i), static_cast(j)); TS_FAIL(temp); return false; } if (!Geom::are_near((*la).finalPoint(),(*lb).finalPoint(), eps)) { char temp[200]; - sprintf(temp, "Different end of segment: (%g,%g) != (%g,%g), subpath: %u, segment: %u", (*la).finalPoint()[Geom::X], (*la).finalPoint()[Geom::Y], (*lb).finalPoint()[Geom::X], (*lb).finalPoint()[Geom::Y], i, j); + sprintf(temp, "Different end of segment: (%g,%g) != (%g,%g), subpath: %u, segment: %u", (*la).finalPoint()[Geom::X], (*la).finalPoint()[Geom::Y], (*lb).finalPoint()[Geom::X], (*lb).finalPoint()[Geom::Y], static_cast(i), static_cast(j)); TS_FAIL(temp); return false; } char temp[200]; - sprintf(temp, "A LineSegment and a VLineSegment have been considered equal. Subpath: %u, segment: %u", i, j); + sprintf(temp, "A LineSegment and a VLineSegment have been considered equal. Subpath: %u, segment: %u", static_cast(i), static_cast(j)); TS_TRACE(temp); } else { char temp[200]; - sprintf(temp, "Different curve types: %s != %s, subpath: %u, segment: %u", typeid(*ca).name(), typeid(*cb).name(), i, j); + sprintf(temp, "Different curve types: %s != %s, subpath: %u, segment: %u", typeid(*ca).name(), typeid(*cb).name(), static_cast(i), static_cast(j)); TS_FAIL(temp); } } @@ -567,44 +567,44 @@ private: if (Geom::HLineSegment const *la = dynamic_cast(ca)) { if (!Geom::are_near((*la).initialPoint(),(*lb).initialPoint(), eps)) { char temp[200]; - sprintf(temp, "Different start of segment: (%g,%g) != (%g,%g), subpath: %u, segment: %u", (*la).initialPoint()[Geom::X], (*la).initialPoint()[Geom::Y], (*lb).initialPoint()[Geom::X], (*lb).initialPoint()[Geom::Y], i, j); + sprintf(temp, "Different start of segment: (%g,%g) != (%g,%g), subpath: %u, segment: %u", (*la).initialPoint()[Geom::X], (*la).initialPoint()[Geom::Y], (*lb).initialPoint()[Geom::X], (*lb).initialPoint()[Geom::Y], static_cast(i), static_cast(j)); TS_FAIL(temp); return false; } if (!Geom::are_near((*la).finalPoint(),(*lb).finalPoint(), eps)) { char temp[200]; - sprintf(temp, "Different end of segment: (%g,%g) != (%g,%g), subpath: %u, segment: %u", (*la).finalPoint()[Geom::X], (*la).finalPoint()[Geom::Y], (*lb).finalPoint()[Geom::X], (*lb).finalPoint()[Geom::Y], i, j); + sprintf(temp, "Different end of segment: (%g,%g) != (%g,%g), subpath: %u, segment: %u", (*la).finalPoint()[Geom::X], (*la).finalPoint()[Geom::Y], (*lb).finalPoint()[Geom::X], (*lb).finalPoint()[Geom::Y], static_cast(i), static_cast(j)); TS_FAIL(temp); return false; } char temp[200]; - sprintf(temp, "An HLineSegment and a LineSegment have been considered equal. Subpath: %u, segment: %u", i, j); + sprintf(temp, "An HLineSegment and a LineSegment have been considered equal. Subpath: %u, segment: %u", static_cast(i), static_cast(j)); TS_TRACE(temp); } else if (Geom::VLineSegment const *la = dynamic_cast(ca)) { if (!Geom::are_near((*la).initialPoint(),(*lb).initialPoint(), eps)) { char temp[200]; - sprintf(temp, "Different start of segment: (%g,%g) != (%g,%g), subpath: %u, segment: %u", (*la).initialPoint()[Geom::X], (*la).initialPoint()[Geom::Y], (*lb).initialPoint()[Geom::X], (*lb).initialPoint()[Geom::Y], i, j); + sprintf(temp, "Different start of segment: (%g,%g) != (%g,%g), subpath: %u, segment: %u", (*la).initialPoint()[Geom::X], (*la).initialPoint()[Geom::Y], (*lb).initialPoint()[Geom::X], (*lb).initialPoint()[Geom::Y], static_cast(i), static_cast(j)); TS_FAIL(temp); return false; } if (!Geom::are_near((*la).finalPoint(),(*lb).finalPoint(), eps)) { char temp[200]; - sprintf(temp, "Different end of segment: (%g,%g) != (%g,%g), subpath: %u, segment: %u", (*la).finalPoint()[Geom::X], (*la).finalPoint()[Geom::Y], (*lb).finalPoint()[Geom::X], (*lb).finalPoint()[Geom::Y], i, j); + sprintf(temp, "Different end of segment: (%g,%g) != (%g,%g), subpath: %u, segment: %u", (*la).finalPoint()[Geom::X], (*la).finalPoint()[Geom::Y], (*lb).finalPoint()[Geom::X], (*lb).finalPoint()[Geom::Y], static_cast(i), static_cast(j)); TS_FAIL(temp); return false; } char temp[200]; - sprintf(temp, "A VLineSegment and a LineSegment have been considered equal. Subpath: %u, segment: %u", i, j); + sprintf(temp, "A VLineSegment and a LineSegment have been considered equal. Subpath: %u, segment: %u", static_cast(i), static_cast(j)); TS_TRACE(temp); } else { char temp[200]; - sprintf(temp, "Different curve types: %s != %s, subpath: %u, segment: %u", typeid(*ca).name(), typeid(*cb).name(), i, j); + sprintf(temp, "Different curve types: %s != %s, subpath: %u, segment: %u", typeid(*ca).name(), typeid(*cb).name(), static_cast(i), static_cast(j)); TS_FAIL(temp); return false; } } else { char temp[200]; - sprintf(temp, "Different curve types: %s != %s, subpath: %u, segment: %u", typeid(*ca).name(), typeid(*cb).name(), i, j); + sprintf(temp, "Different curve types: %s != %s, subpath: %u, segment: %u", typeid(*ca).name(), typeid(*cb).name(), static_cast(i), static_cast(j)); TS_FAIL(temp); } }