comparison data/model/test/TestSparseModels.h @ 1659:8bf3a52a1604 single-point

Work on start/end frame stuff to match API description
author Chris Cannam
date Thu, 21 Mar 2019 11:35:30 +0000
parents 5b7b01da430a
children 353a2d15f213
comparison
equal deleted inserted replaced
1658:5b7b01da430a 1659:8bf3a52a1604
41 QCOMPARE(m.getResolution(), 10); 41 QCOMPARE(m.getResolution(), 10);
42 QCOMPARE(m.isSparse(), true); 42 QCOMPARE(m.isSparse(), true);
43 43
44 Event p(10); 44 Event p(10);
45 m.add(p); 45 m.add(p);
46 /*!!!
47 m.clear();
48 QCOMPARE(m.isEmpty(), true);
49 QCOMPARE(m.getEventCount(), 0);
50 QCOMPARE(m.getAllEvents().size(), 0);
51 QCOMPARE(m.getStartFrame(), 0);
52 QCOMPARE(m.getEndFrame(), 0);
53
54 m.add(p);
55 */
56 m.remove(p); 46 m.remove(p);
57 QCOMPARE(m.isEmpty(), true); 47 QCOMPARE(m.isEmpty(), true);
58 QCOMPARE(m.getEventCount(), 0); 48 QCOMPARE(m.getEventCount(), 0);
59 QCOMPARE(m.getAllEvents().size(), 0); 49 QCOMPARE(m.getAllEvents().size(), 0);
60 QCOMPARE(m.getStartFrame(), 0); 50 QCOMPARE(m.getStartFrame(), 0);
93 m.add(p2); 83 m.add(p2);
94 m.add(p3); 84 m.add(p3);
95 QCOMPARE(m.getAllEvents().size(), 3); 85 QCOMPARE(m.getAllEvents().size(), 3);
96 QCOMPARE(*m.getAllEvents().begin(), p1); 86 QCOMPARE(*m.getAllEvents().begin(), p1);
97 QCOMPARE(*m.getAllEvents().rbegin(), p3); 87 QCOMPARE(*m.getAllEvents().rbegin(), p3);
98 /*!!! 88
99 auto pp = m.getAllEvents(20, 30); 89 // The EventSeries that is used internally is tested more
90 // thoroughly in its own test suite. This is just a check
91 auto pp = m.getEventsWithin(20, 10);
100 QCOMPARE(pp.size(), 2); 92 QCOMPARE(pp.size(), 2);
101 QCOMPARE(*pp.begin(), p1); 93 QCOMPARE(*pp.begin(), p1);
102 QCOMPARE(*pp.rbegin(), p2); 94 QCOMPARE(*pp.rbegin(), p2);
103 95
104 pp = m.getAllEvents(40, 50); 96 pp = m.getEventsWithin(40, 10);
105 QCOMPARE(pp.size(), 0); 97 QCOMPARE(pp.size(), 0);
106 98
107 pp = m.getAllEvents(50, 50); 99 pp = m.getEventsStartingAt(50);
108 QCOMPARE(pp.size(), 1); 100 QCOMPARE(pp.size(), 1);
109 QCOMPARE(*pp.begin(), p3); 101 QCOMPARE(*pp.begin(), p3);
110 */
111 } 102 }
112 103
113 void s1d_xml() { 104 void s1d_xml() {
114 SparseOneDimensionalModel m(100, 10, false); 105 SparseOneDimensionalModel m(100, 10, false);
115 m.setObjectName("This \"&\" that"); 106 m.setObjectName("This \"&\" that");