Code

Refactoring SPColor to C++ and removing legacy CMYK implementation
[inkscape.git] / src / sp-style-elem-test.h
index e5b2e8a481d82d80f2e270a87a0ba7ada130f21c..755fe4418af9295cf9b89f59bf1300fa56ae8f34 100644 (file)
@@ -73,11 +73,17 @@ public:
 
     void testWrite()
     {
+        TS_ASSERT( _doc );
+        TS_ASSERT( sp_document_repr_doc(_doc) );
+        if ( !sp_document_repr_doc(_doc) ) {
+            return; // evil early return
+        }
+
         SPStyleElem *style_elem = SP_STYLE_ELEM(g_object_new(SP_TYPE_STYLE_ELEM, NULL));
         SP_OBJECT(style_elem)->document = _doc;
 
         sp_object_set(SP_OBJECT(style_elem), SP_ATTR_TYPE, "text/css");
-        Inkscape::XML::Node *repr = sp_repr_new("svg:style");
+        Inkscape::XML::Node *repr = sp_document_repr_doc(_doc)->createElement("svg:style");
         SP_OBJECT(style_elem)->updateRepr(repr, SP_OBJECT_WRITE_ALL);
         {
             gchar const *typ = repr->attribute("type");
@@ -93,8 +99,14 @@ public:
 
     void testBuild()
     {
+        TS_ASSERT( _doc );
+        TS_ASSERT( sp_document_repr_doc(_doc) );
+        if ( !sp_document_repr_doc(_doc) ) {
+            return; // evil early return
+        }
+
         SPStyleElem &style_elem = *SP_STYLE_ELEM(g_object_new(SP_TYPE_STYLE_ELEM, NULL));
-        Inkscape::XML::Node *const repr = sp_repr_new("svg:style");
+        Inkscape::XML::Node *const repr = sp_document_repr_doc(_doc)->createElement("svg:style");
         repr->setAttribute("type", "text/css");
         sp_object_invoke_build(&style_elem, _doc, repr, false);
         TS_ASSERT( style_elem.is_css );
@@ -115,10 +127,16 @@ public:
 
     void testReadContent()
     {
+        TS_ASSERT( _doc );
+        TS_ASSERT( sp_document_repr_doc(_doc) );
+        if ( !sp_document_repr_doc(_doc) ) {
+            return; // evil early return
+        }
+
         SPStyleElem &style_elem = *SP_STYLE_ELEM(g_object_new(SP_TYPE_STYLE_ELEM, NULL));
-        Inkscape::XML::Node *const repr = sp_repr_new("svg:style");
+        Inkscape::XML::Node *const repr = sp_document_repr_doc(_doc)->createElement("svg:style");
         repr->setAttribute("type", "text/css");
-        Inkscape::XML::Node *const content_repr = sp_repr_new_text(".myclass { }");
+        Inkscape::XML::Node *const content_repr = sp_document_repr_doc(_doc)->createTextNode(".myclass { }");
         repr->addChild(content_repr, NULL);
         sp_object_invoke_build(&style_elem, _doc, repr, false);
         TS_ASSERT( style_elem.is_css );