diff data/model/test/TestSparseModels.h @ 1662:628ffbb05856 single-point

Update PathModel - doesn't use new EventSeries, but doesn't use SparseModel either - it's simpler than that
author Chris Cannam
date Fri, 22 Mar 2019 13:32:09 +0000
parents 353a2d15f213
children a77a7e8c085c
line wrap: on
line diff
--- a/data/model/test/TestSparseModels.h	Fri Mar 22 11:04:51 2019 +0000
+++ b/data/model/test/TestSparseModels.h	Fri Mar 22 13:32:09 2019 +0000
@@ -18,6 +18,7 @@
 #include "../SparseOneDimensionalModel.h"
 #include "../NoteModel.h"
 #include "../TextModel.h"
+#include "../PathModel.h"
 
 #include <QObject>
 #include <QtTest>
@@ -246,6 +247,34 @@
         }
         QCOMPARE(xml, expected);
     }
+    
+    void path_xml() {
+        PathModel m(100, 10, false);
+        PathPoint p1(20, 30);
+        PathPoint p2(40, 60);
+        PathPoint p3(50, 49);
+        m.addPoint(p1);
+        m.addPoint(p2);
+        m.addPoint(p3);
+        QString xml;
+        QTextStream str(&xml, QIODevice::WriteOnly);
+        m.toXml(str);
+        str.flush();
+
+        QString expected =
+            "<model id='7' name='' sampleRate='100' start='20' end='80' type='sparse' dimensions='2' resolution='10' notifyOnAdd='true' dataset='4' subtype='path' />\n"
+            "<dataset id='6' dimensions='2'>\n"
+            "  <point frame='20' mapframe='30' />\n"
+            "  <point frame='40' mapframe='60' />\n"
+            "  <point frame='50' mapframe='49' />\n"
+            "</dataset>\n";
+        expected.replace("\'", "\"");
+        if (xml != expected) {
+            cerr << "Obtained xml:\n" << xml
+                 << "\nExpected:\n" << expected << endl;
+        }
+        QCOMPARE(xml, expected);
+    }
         
 };