summaryrefslogtreecommitdiffstats
path: root/src/xml
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2008-12-09 00:06:13 +0000
committertweenk <tweenk@users.sourceforge.net>2008-12-09 00:06:13 +0000
commited0c006e81c69fbed16181c512c55190d998892e (patch)
tree37e6c6d558eceb3e7b4ac9f5ac3aaac41b854863 /src/xml
parentfix for Bug #234305 (paste into transformed groups) (diff)
downloadinkscape-ed0c006e81c69fbed16181c512c55190d998892e.tar.gz
inkscape-ed0c006e81c69fbed16181c512c55190d998892e.zip
Simplify "make check" makefile rules and remove most of the obsolete
utest-based tests. (bzr r6976)
Diffstat (limited to 'src/xml')
-rw-r--r--src/xml/Makefile_insert37
-rw-r--r--src/xml/quote-test.cpp84
-rw-r--r--src/xml/repr-action-test.cpp77
3 files changed, 9 insertions, 189 deletions
diff --git a/src/xml/Makefile_insert b/src/xml/Makefile_insert
index 5810052de..9ca81b231 100644
--- a/src/xml/Makefile_insert
+++ b/src/xml/Makefile_insert
@@ -53,45 +53,26 @@ xml_libspxml_a_SOURCES = \
xml/invalid-operation-exception.h \
xml/xml-forward.h
-xml/test-xml-main.cpp: xml/test-xml.cpp $(xml_test_xml_includes)
- $(top_srcdir)/cxxtest/cxxtestgen.pl --template=$(srcdir)/selfname.tpl -root -o xml/test-xml-main.cpp $(xml_test_xml_includes)
-
-xml/test-xml.cpp: $(xml_test_xml_includes)
- $(top_srcdir)/cxxtest/cxxtestgen.pl --have-eh -part -o xml/test-xml.cpp $(xml_test_xml_includes)
-
-xml_test_xml_includes = \
+# ######################
+# ### CxxTest stuff ####
+# ######################
+xml_testsuites = \
$(srcdir)/xml/repr-action-test.h \
$(srcdir)/xml/quote-test.h
-xml_libtest_xml_a_SOURCES = \
- xml/test-xml.cpp \
- $(xml_test_xml_includes)
-
xml_test_xml_SOURCES = \
- xml/test-xml-main.cpp \
- $(xml_test_xml_includes)
+ xml/test-xml.cpp \
+ $(xml_testsuites)
xml_test_xml_LDADD = \
- xml/libtest-xml.a \
xml/libspxml.a \
util/libinkutil.a \
svg/libspsvg.a \
+ helper/libspchelp.a \
test-stubs.o \
libinkpost.a \
debug/libinkdebug.a \
$(INKSCAPE_LIBS)
-
-xml_repr_action_test_SOURCES = \
- xml/repr-action-test.cpp
-xml_repr_action_test_LDADD = \
- xml/libspxml.a \
- svg/libspsvg.a \
- libtest-stubs.a \
- util/libinkutil.a \
- libinkpost.a \
- debug/libinkdebug.a \
- $(INKSCAPE_LIBS)
-
-xml_quote_test_SOURCES = xml/quote-test.cpp
-xml_quote_test_LDADD = $(INKSCAPE_LIBS)
+xml/test-xml.cpp: $(xml_testsuites) xml/Makefile_insert $(CXXTEST_TEMPLATE)
+ $(CXXTESTGEN) -o xml/test-xml.cpp $(xml_testsuites)
diff --git a/src/xml/quote-test.cpp b/src/xml/quote-test.cpp
deleted file mode 100644
index 197ca5309..000000000
--- a/src/xml/quote-test.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/* Initial author: Peter Moulder.
- Hereby released into the Public Domain. */
-
-#include <cstring>
-#include <functional>
-
-#include "utest/test-1ary-cases.h"
-
-/* mental disclaims all responsibility for this evil idea for testing
- static functions. The main disadvantages are that we retain any
- #define's and `using' directives of the included file. */
-#include "quote.cpp"
-
-struct streq_free2 {
- bool operator()(char const *exp, char *got)
- {
- bool const ret = (strcmp(exp, got) == 0);
- g_free(got);
- return ret;
- }
-};
-
-static bool
-test_xml_quoted_strlen()
-{
- utest_start("xml_quoted_strlen");
- struct Case1<char const *, size_t> cases[] = {
- {"", 0},
- {"x", 1},
- {"Foo", 3},
- {"\"", 6},
- {"&", 5},
- {"<", 4},
- {">", 4},
- {"a\"b", 8},
- {"a\"b<c>d;!@#$%^*(\\)?", 30}
- };
- test_1ary_cases<size_t, char const *, size_t, std::equal_to<size_t> >("xml_quoted_strlen",
- xml_quoted_strlen,
- G_N_ELEMENTS(cases),
- cases);
- return utest_end();
-}
-
-static bool
-test_xml_quote_strdup()
-{
- utest_start("xml_quote_strdup");
- struct Case1<char const *, char const *> cases[] = {
- {"", ""},
- {"x", "x"},
- {"Foo", "Foo"},
- {"\"", "&quot;"},
- {"&", "&amp;"},
- {"<", "&lt;"},
- {">", "&gt;"},
- {"a\"b<c>d;!@#$%^*(\\)?", "a&quot;b&lt;c&gt;d;!@#$%^*(\\)?"}
- };
- test_1ary_cases<char *, char const *, char const *, streq_free2>("xml_quote_strdup",
- xml_quote_strdup,
- G_N_ELEMENTS(cases),
- cases);
- return utest_end();
-}
-
-int main() {
- bool const succ = (test_xml_quoted_strlen()
- && test_xml_quote_strdup());
- return ( succ
- ? EXIT_SUCCESS
- : EXIT_FAILURE );
-}
-
-
-/*
- 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:encoding=utf-8:textwidth=99 :
diff --git a/src/xml/repr-action-test.cpp b/src/xml/repr-action-test.cpp
deleted file mode 100644
index d36ff4106..000000000
--- a/src/xml/repr-action-test.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-#include <cstdlib>
-#include <glib.h>
-#include "../utest/utest.h"
-
-#include "repr.h"
-#include "event-fns.h"
-
-int main(int /*argc*/, char */*argv*/[]) {
- Inkscape::XML::Document *document;
- Inkscape::XML::Node *a, *b, *c, *root;
-
- Inkscape::GC::init();
-
- document = sp_repr_document_new("test");
- root = document->root();
-
- utest_start("XML Transactions");
-
- a = document->createElement("a");
- b = document->createElement("b");
- c = document->createElement("c");
-
- UTEST_TEST("rollback of node addition") {
- sp_repr_begin_transaction(document);
- UTEST_ASSERT(sp_repr_parent(a) == NULL);
-
- root->appendChild(a);
- UTEST_ASSERT(sp_repr_parent(a) == root);
-
- sp_repr_rollback(document);
- UTEST_ASSERT(sp_repr_parent(a) == NULL);
- }
-
- UTEST_TEST("rollback of node removal") {
- root->appendChild(a);
-
- sp_repr_begin_transaction(document);
- UTEST_ASSERT(sp_repr_parent(a) == root);
-
- sp_repr_unparent(a);
- UTEST_ASSERT(sp_repr_parent(a) == NULL);
-
- sp_repr_rollback(document);
- UTEST_ASSERT(sp_repr_parent(a) == root);
- }
-
- sp_repr_unparent(a);
-
- UTEST_TEST("rollback of node reordering") {
- root->appendChild(a);
- root->appendChild(b);
- root->appendChild(c);
-
- sp_repr_begin_transaction(document);
- UTEST_ASSERT(sp_repr_next(a) == b);
- UTEST_ASSERT(sp_repr_next(b) == c);
- UTEST_ASSERT(sp_repr_next(c) == NULL);
-
- root->changeOrder(b, c);
- UTEST_ASSERT(sp_repr_next(a) == c);
- UTEST_ASSERT(sp_repr_next(b) == NULL);
- UTEST_ASSERT(sp_repr_next(c) == b);
-
- sp_repr_rollback(document);
- UTEST_ASSERT(sp_repr_next(a) == b);
- UTEST_ASSERT(sp_repr_next(b) == c);
- UTEST_ASSERT(sp_repr_next(c) == NULL);
- }
-
- sp_repr_unparent(a);
- sp_repr_unparent(b);
- sp_repr_unparent(c);
-
- /* lots more tests needed ... */
-
- return utest_end() ? 0 : 1;
-}