comparison data/model/test/TestSparseModels.h @ 1614:2e14a7876945 single-point

Fixes and tests for PointSeries
author Chris Cannam
date Thu, 07 Mar 2019 14:35:57 +0000
parents b2f32c554199
children 7a23dfe65d66
comparison
equal deleted inserted replaced
1613:ea4f3593c39c 1614:2e14a7876945
134 QCOMPARE(xml, expected); 134 QCOMPARE(xml, expected);
135 } 135 }
136 136
137 void note_extents() { 137 void note_extents() {
138 NoteModel m(100, 10, false); 138 NoteModel m(100, 10, false);
139 NoteModel::Point p1(20, 123.4, 40, 0.8, "note 1"); 139 NoteModel::Point p1(20, 123.4f, 40, 0.8f, "note 1");
140 m.addPoint(p1); 140 m.addPoint(p1);
141 QCOMPARE(m.isEmpty(), false); 141 QCOMPARE(m.isEmpty(), false);
142 QCOMPARE(m.getPointCount(), 1); 142 QCOMPARE(m.getPointCount(), 1);
143 NoteModel::Point p2(50, 124.3, 30, 0.9, "note 2"); 143 NoteModel::Point p2(50, 124.3f, 30, 0.9f, "note 2");
144 m.addPoint(p2); 144 m.addPoint(p2);
145 QCOMPARE(m.isEmpty(), false); 145 QCOMPARE(m.isEmpty(), false);
146 QCOMPARE(m.getPointCount(), 2); 146 QCOMPARE(m.getPointCount(), 2);
147 QCOMPARE(m.getPoints().size(), 2); 147 QCOMPARE(m.getPoints().size(), 2);
148 QCOMPARE(*m.getPoints().begin(), p1); 148 QCOMPARE(*m.getPoints().begin(), p1);
161 QCOMPARE(m.containsPoint(p1), false); 161 QCOMPARE(m.containsPoint(p1), false);
162 } 162 }
163 163
164 void note_sample() { 164 void note_sample() {
165 NoteModel m(100, 10, false); 165 NoteModel m(100, 10, false);
166 NoteModel::Point p1(20, 123.4, 20, 0.8, "note 1"); 166 NoteModel::Point p1(20, 123.4f, 20, 0.8f, "note 1");
167 NoteModel::Point p2(20, 124.3, 10, 0.9, "note 2"); 167 NoteModel::Point p2(20, 124.3f, 10, 0.9f, "note 2");
168 NoteModel::Point p3(50, 126.3, 30, 0.9, "note 3"); 168 NoteModel::Point p3(50, 126.3f, 30, 0.9f, "note 3");
169 m.addPoint(p1); 169 m.addPoint(p1);
170 m.addPoint(p2); 170 m.addPoint(p2);
171 m.addPoint(p3); 171 m.addPoint(p3);
172 172
173 QCOMPARE(m.getPoints().size(), 3); 173 QCOMPARE(m.getPoints().size(), 3);
191 QCOMPARE(*pp.begin(), p3); 191 QCOMPARE(*pp.begin(), p3);
192 } 192 }
193 193
194 void note_xml() { 194 void note_xml() {
195 NoteModel m(100, 10, false); 195 NoteModel m(100, 10, false);
196 NoteModel::Point p1(20, 123.4, 20, 0.8, "note 1"); 196 NoteModel::Point p1(20, 123.4f, 20, 0.8f, "note 1");
197 NoteModel::Point p2(20, 124.3, 10, 0.9, "note 2"); 197 NoteModel::Point p2(20, 124.3f, 10, 0.9f, "note 2");
198 NoteModel::Point p3(50, 126.3, 30, 0.9, "note 3"); 198 NoteModel::Point p3(50, 126.3f, 30, 0.9f, "note 3");
199 m.setScaleUnits("Hz"); 199 m.setScaleUnits("Hz");
200 m.addPoint(p1); 200 m.addPoint(p1);
201 m.addPoint(p2); 201 m.addPoint(p2);
202 m.addPoint(p3); 202 m.addPoint(p3);
203 QString xml; 203 QString xml;