summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c77f1e2)
raw | patch | inline | side by side (parent: c77f1e2)
author | Jon A. Cruz <jon@joncruz.org> | |
Tue, 14 Dec 2010 09:12:46 +0000 (01:12 -0800) | ||
committer | Jon A. Cruz <jon@joncruz.org> | |
Tue, 14 Dec 2010 09:12:46 +0000 (01:12 -0800) |
src/sp-gradient-test.h | patch | blob | history | |
src/sp-style-elem-test.h | patch | blob | history | |
src/svg/svg-path-geom-test.h | patch | blob | history |
diff --git a/src/sp-gradient-test.h b/src/sp-gradient-test.h
index 2a061595eea857747f53549d647ff6f68ea5f06f..5ab08467dc80c5ee7c3c8d03123d9c717ceed4ff 100644 (file)
--- a/src/sp-gradient-test.h
+++ b/src/sp-gradient-test.h
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);
{
index 53362d3e374096a3ad1e8bef63757a7135a26810..7021be13de836a1d1cc2d0075b00928aa0e3e3ce 100644 (file)
--- a/src/sp-style-elem-test.h
+++ b/src/sp-style-elem-test.h
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
}
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 );
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 );
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 );
index 239a975f65a5aa044eb997da3700d7f2144e37ff..5735b6017bc98fbbe00a897f7ea418662c996dd8 100644 (file)
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<unsigned int>(a.size()),static_cast<unsigned int>( b.size()));
TS_FAIL(temp);
return false;
}
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<unsigned int>(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<unsigned int>(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<unsigned int>(pa.size()), static_cast<unsigned int>(pb.size()), static_cast<unsigned int>(i));
TS_FAIL(temp);
return false;
}
Geom::LineSegment const *lb = dynamic_cast<Geom::LineSegment const*>(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<unsigned int>(i), static_cast<unsigned int>(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<unsigned int>(i), static_cast<unsigned int>(j));
TS_FAIL(temp);
return false;
}
Geom::HLineSegment const *lb = dynamic_cast<Geom::HLineSegment const*>(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<unsigned int>(i), static_cast<unsigned int>(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<unsigned int>(i), static_cast<unsigned int>(j));
TS_FAIL(temp);
return false;
}
Geom::VLineSegment const *lb = dynamic_cast<Geom::VLineSegment const*>(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<unsigned int>(i), static_cast<unsigned int>(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<unsigned int>(i), static_cast<unsigned int>(j));
TS_FAIL(temp);
return false;
}
Geom::CubicBezier const *lb = dynamic_cast<Geom::CubicBezier const*>(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<unsigned int>(i), static_cast<unsigned int>(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<unsigned int>(i), static_cast<unsigned int>(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<unsigned int>(i), static_cast<unsigned int>(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<unsigned int>(i), static_cast<unsigned int>(j));
TS_FAIL(temp);
return false;
}
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<unsigned int>(i), static_cast<unsigned int>(j));
TS_FAIL(temp);
}
}
if (Geom::HLineSegment const *lb = dynamic_cast<Geom::HLineSegment const*>(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<unsigned int>(i), static_cast<unsigned int>(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<unsigned int>(i), static_cast<unsigned int>(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<unsigned int>(i), static_cast<unsigned int>(j));
TS_TRACE(temp);
} else if (Geom::VLineSegment const *lb = dynamic_cast<Geom::VLineSegment const*>(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<unsigned int>(i), static_cast<unsigned int>(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<unsigned int>(i), static_cast<unsigned int>(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<unsigned int>(i), static_cast<unsigned int>(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<unsigned int>(i), static_cast<unsigned int>(j));
TS_FAIL(temp);
}
}
if (Geom::HLineSegment const *la = dynamic_cast<Geom::HLineSegment const*>(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<unsigned int>(i), static_cast<unsigned int>(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<unsigned int>(i), static_cast<unsigned int>(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<unsigned int>(i), static_cast<unsigned int>(j));
TS_TRACE(temp);
} else if (Geom::VLineSegment const *la = dynamic_cast<Geom::VLineSegment const*>(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<unsigned int>(i), static_cast<unsigned int>(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<unsigned int>(i), static_cast<unsigned int>(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<unsigned int>(i), static_cast<unsigned int>(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<unsigned int>(i), static_cast<unsigned int>(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<unsigned int>(i), static_cast<unsigned int>(j));
TS_FAIL(temp);
}
}