[Kst] branches/work/kst/portto4/kst/tests

Mike Fenton mike at staikos.net
Thu Sep 27 15:47:32 CEST 2007


SVN commit 717754 by fenton:

Port of existing tests to new format.


 M  +21 -0     main.cpp  
 AM            testamatrix.cpp   [License: GPL (v2+)]
 AM            testamatrix.h   [License: GPL (v2+)]
 AM            testcsd.cpp   [License: GPL (v2+)]
 AM            testcsd.h   [License: GPL (v2+)]
 AM            testhistogram.cpp   [License: GPL (v2+)]
 AM            testhistogram.h   [License: GPL (v2+)]
 AM            testlabelparser.cpp   [License: GPL (v2+)]
 AM            testlabelparser.h   [License: GPL (v2+)]
 M  +1 -2      testpsd.cpp  
 M  +3 -0      testpsd.h  
 M  +14 -4     tests.pro  
 M  +6 -6      testscalar.cpp  
 M  +3 -1      testscalar.h  


--- branches/work/kst/portto4/kst/tests/main.cpp #717753:717754
@@ -17,7 +17,12 @@
 #include "testvector.h"
 #include "testscalar.h"
 #include "testmatrix.h"
+#include "testcsd.h"
 #include "testpsd.h"
+#include "testhistogram.h"
+#include "testamatrix.h"
+#include "testlabelparser.h"
+#include "testeqparser.h"
 
 int main(int argc, char *argv[]) {
   QCoreApplication app(argc, argv);
@@ -37,6 +42,22 @@
   TestPSD test5;
   QTest::qExec(&test5, argc, argv);
 
+  TestHistogram test6;
+  QTest::qExec(&test6, argc, argv);
+
+  TestCSD test7;
+  QTest::qExec(&test7, argc, argv);
+
+  TestAMatrix test8;
+  QTest::qExec(&test8, argc, argv);
+
+  TestLabelParser test9;
+  QTest::qExec(&test9, argc, argv);
+
+  TestEqParser test10;
+  QTest::qExec(&test10, argc, argv);
+
+
   return 0;
 }
 
** branches/work/kst/portto4/kst/tests/testamatrix.cpp #property svn:executable
   + *
** branches/work/kst/portto4/kst/tests/testamatrix.h #property svn:executable
   + *
** branches/work/kst/portto4/kst/tests/testcsd.cpp #property svn:executable
   + *
** branches/work/kst/portto4/kst/tests/testcsd.h #property svn:executable
   + *
** branches/work/kst/portto4/kst/tests/testhistogram.cpp #property svn:executable
   + *
** branches/work/kst/portto4/kst/tests/testhistogram.h #property svn:executable
   + *
** branches/work/kst/portto4/kst/tests/testlabelparser.cpp #property svn:executable
   + *
** branches/work/kst/portto4/kst/tests/testlabelparser.h #property svn:executable
   + *
--- branches/work/kst/portto4/kst/tests/testpsd.cpp #717753:717754
@@ -15,7 +15,6 @@
 
 #include <QDir>
 #include <QFile>
-#include <QDomDocument>
 #include <QTemporaryFile>
 
 #include <kstpsd.h>
@@ -29,7 +28,7 @@
 }
 
 
-QDomDocument makeDOMElement(const QString& tag, const QString& val) {
+QDomDocument TestPSD::makeDOMElement(const QString& tag, const QString& val) {
 // Should be some boundary checking in the constructor.
   QDomDocument psdDOM("psddocument");
   QDomElement psdElement, child;
--- branches/work/kst/portto4/kst/tests/testpsd.h #717753:717754
@@ -13,10 +13,13 @@
 #define TESTPSD_H
 
 #include <QObject>
+#include <QDomDocument>
 
 class TestPSD : public QObject
 {
   Q_OBJECT
+  private:
+    QDomDocument makeDOMElement(const QString& tag, const QString& val);
   private Q_SLOTS:
     void cleanupTestCase();
 
--- branches/work/kst/portto4/kst/tests/tests.pro #717753:717754
@@ -21,17 +21,27 @@
 
 SOURCES += \
     main.cpp \
+    testamatrix.cpp \
+    testcsd.cpp \
     testdatasource.cpp \
-    testvector.cpp \
+    testeqparser.cpp \
+    testhistogram.cpp \
+    testlabelparser.cpp \
     testscalar.cpp \
     testmatrix.cpp \
-    testpsd.cpp
+    testpsd.cpp \
+    testvector.cpp 
 
 HEADERS += \
+    testamatrix.h \
+    testcsd.h \
     testdatasource.h \
-    testvector.h \
+    testhistogram.h \
+    testeqparser.h \
+    testlabelparser.h \
     testscalar.h \
     testmatrix.h \
-    testpsd.h
+    testpsd.h \
+    testvector.h 
 
 QMAKE_RPATHDIR += $$OUTPUT_DIR/lib $$OUTPUT_DIR/plugin
--- branches/work/kst/portto4/kst/tests/testscalar.cpp #717753:717754
@@ -36,7 +36,7 @@
 void SListener::trigger() { _trigger++; }
 
 
-QDomDocument makeDOM1(const QString& tag, const QString& val, bool orphan = false) {
+QDomDocument TestScalar::makeDOMDocument(const QString& tag, const QString& val, bool orphan) {
   QDomDocument loadTest("scalardocument");
   QDomElement scalardoc, child;
   QDomText text;
@@ -103,7 +103,7 @@
 
   QDomNode n;
   QDomElement e;
-  n = makeDOM1("load1", "2.14159265").firstChild();
+  n = makeDOMDocument("load1", "2.14159265").firstChild();
   e = n.toElement();
   KstScalarPtr sp3 = new KstScalar(e);
   QCOMPARE(sp3->orphan(), false);
@@ -111,7 +111,7 @@
   QCOMPARE(sp3->tagName(), QLatin1String("load1"));
   QVERIFY(sp3->displayable());
 
-  n = makeDOM1("55.4232", "55.4232", true).firstChild();
+  n = makeDOMDocument("55.4232", "55.4232", true).firstChild();
   e = n.toElement();
   KstScalarPtr sp4 = new KstScalar(e);
   QVERIFY(sp4->orphan());
@@ -119,18 +119,18 @@
   QCOMPARE(sp4->tagName(), QLatin1String("55.4232"));
   QVERIFY(!sp4->displayable());
 
-  n = makeDOM1("load2", "NAN").firstChild();
+  n = makeDOMDocument("load2", "NAN").firstChild();
   e = n.toElement();
   sp4 = new KstScalar(e);
   QVERIFY(sp4->value() != sp4->value());
 
-  n = makeDOM1("load3", "INF").firstChild();
+  n = makeDOMDocument("load3", "INF").firstChild();
   e = n.toElement();
   sp4 = new KstScalar(e);
 
   QVERIFY(sp4->value() == _INF);
 
-  n = makeDOM1("load4", "-INF").firstChild();
+  n = makeDOMDocument("load4", "-INF").firstChild();
   e = n.toElement();
   sp4 = new KstScalar(e);
 
--- branches/work/kst/portto4/kst/tests/testscalar.h #717753:717754
@@ -13,6 +13,7 @@
 #define TESTSCALAR_H
 
 #include <QObject>
+#include <QDomDocument>
 
 class SListener : public QObject {
   Q_OBJECT
@@ -20,7 +21,6 @@
     SListener();
     virtual ~SListener();
     int _trigger;
-
   public Q_SLOTS:
     void trigger();
 };
@@ -28,6 +28,8 @@
 class TestScalar : public QObject
 {
   Q_OBJECT
+  private:
+    QDomDocument makeDOMDocument(const QString& tag, const QString& val, bool orphan = false);
   private Q_SLOTS:
     void cleanupTestCase();
 


More information about the Kst mailing list