1
#include "signalplottertest.h"
2
#include "../../../libs/ksysguard/signalplotter/ksignalplotter.h"
9
void TestSignalPlotter::init()
11
s = new KSignalPlotter;
13
void TestSignalPlotter::cleanup()
18
void TestSignalPlotter::testAddRemoveBeams()
20
//Just try various variations of adding and removing beams
21
QCOMPARE(s->numBeams(), 0);
25
QCOMPARE(s->numBeams(), 2);
26
QVERIFY(s->beamColor(0) == Qt::blue);
27
QVERIFY(s->beamColor(1) == Qt::red);
30
QCOMPARE(s->numBeams(), 1);
31
QVERIFY(s->beamColor(0) == Qt::red);
34
QCOMPARE(s->numBeams(), 0);
38
QCOMPARE(s->numBeams(), 2);
39
QVERIFY(s->beamColor(0) == Qt::blue);
40
QVERIFY(s->beamColor(1) == Qt::red);
43
QCOMPARE(s->numBeams(), 1);
44
QVERIFY(s->beamColor(0) == Qt::blue);
47
QCOMPARE(s->numBeams(), 2);
48
QVERIFY(s->beamColor(0) == Qt::blue);
49
QVERIFY(s->beamColor(1) == Qt::red);
51
void TestSignalPlotter::testAddRemoveBeamsWithData()
53
//Just try various variations of adding and removing beams,
54
//this time with data as well
55
QCOMPARE(s->numBeams(), 0);
60
QVERIFY( isnan(s->lastValue(0)) ); //unset, so should default to NaN
61
QVERIFY( isnan(s->lastValue(1)) ); //unset, so should default to NaN
62
QCOMPARE(s->numBeams(), 2);
63
QVERIFY(s->beamColor(0) == Qt::blue);
64
QVERIFY(s->beamColor(1) == Qt::red);
65
s->addSample(QList<qreal>() << 1.0 << 2.0);
66
QCOMPARE(s->lastValue(0), 1.0);
67
QCOMPARE(s->lastValue(1), 2.0);
70
QCOMPARE(s->numBeams(), 1);
71
QVERIFY(s->beamColor(0) == Qt::red);
72
QCOMPARE(s->lastValue(0), 2.0);
75
QCOMPARE(s->numBeams(), 0);
79
s->addSample(QList<qreal>() << 1.0 << 2.0);
80
QCOMPARE(s->numBeams(), 2);
81
QVERIFY(s->beamColor(0) == Qt::blue);
82
QVERIFY(s->beamColor(1) == Qt::red);
83
QCOMPARE(s->lastValue(0), 1.0);
84
QCOMPARE(s->lastValue(1), 2.0);
87
QCOMPARE(s->numBeams(), 1);
88
QVERIFY(s->beamColor(0) == Qt::blue);
89
QCOMPARE(s->lastValue(0), 1.0);
92
QCOMPARE(s->numBeams(), 2);
93
QVERIFY(s->beamColor(0) == Qt::blue);
94
QVERIFY(s->beamColor(1) == Qt::red);
95
QCOMPARE(s->lastValue(0), 1.0);
96
QVERIFY( isnan(s->lastValue(1)) ); //unset, so should default to NaN
99
void TestSignalPlotter::testReorderBeams()
101
QCOMPARE(s->numBeams(), 0);
103
s->reorderBeams(newOrder); // do nothing
104
QCOMPARE(s->numBeams(), 0);
106
s->addBeam(Qt::blue);
108
QCOMPARE(s->numBeams(), 2);
109
QVERIFY(s->beamColor(0) == Qt::blue);
110
QVERIFY(s->beamColor(1) == Qt::red);
112
newOrder << 0 << 1; //nothing changed
113
s->reorderBeams(newOrder);
114
QCOMPARE(s->numBeams(), 2);
115
QVERIFY(s->beamColor(0) == Qt::blue);
116
QVERIFY(s->beamColor(1) == Qt::red);
119
newOrder << 1 << 0; //reverse them
120
s->reorderBeams(newOrder);
121
QCOMPARE(s->numBeams(), 2);
122
QVERIFY(s->beamColor(0) == Qt::red);
123
QVERIFY(s->beamColor(1) == Qt::blue);
125
//reverse them back again
126
s->reorderBeams(newOrder);
127
QCOMPARE(s->numBeams(), 2);
128
QVERIFY(s->beamColor(0) == Qt::blue);
129
QVERIFY(s->beamColor(1) == Qt::red);
131
//switch them yet again
132
s->reorderBeams(newOrder);
135
s->addBeam(Qt::green);
136
QCOMPARE(s->numBeams(), 3);
137
QVERIFY(s->beamColor(0) == Qt::red);
138
QVERIFY(s->beamColor(1) == Qt::blue);
139
QVERIFY(s->beamColor(2) == Qt::green);
142
newOrder << 2 << 0 << 1;
143
s->reorderBeams(newOrder);
144
QCOMPARE(s->numBeams(), 3);
145
QVERIFY(s->beamColor(0) == Qt::green);
146
QVERIFY(s->beamColor(1) == Qt::red);
147
QVERIFY(s->beamColor(2) == Qt::blue);
149
void TestSignalPlotter::testReorderBeamsWithData()
151
QCOMPARE(s->numBeams(), 0);
154
s->addBeam(Qt::blue);
156
QCOMPARE(s->numBeams(), 2);
157
QVERIFY(isnan(s->lastValue(0))); //unset, so should default to NaN
158
QVERIFY(isnan(s->lastValue(1))); //unset, so should default to NaN
163
QCOMPARE(s->lastValue(0), 1.0);
164
QCOMPARE(s->lastValue(1), 2.0);
166
newOrder << 0 << 1; //nothing changed
167
s->reorderBeams(newOrder);
168
QCOMPARE(s->numBeams(), 2);
169
QCOMPARE(s->lastValue(0), 1.0);
170
QCOMPARE(s->lastValue(1), 2.0);
173
newOrder << 1 << 0; //reverse them
174
s->reorderBeams(newOrder);
175
QCOMPARE(s->numBeams(), 2);
176
QCOMPARE(s->lastValue(0), 2.0);
177
QCOMPARE(s->lastValue(1), 1.0);
179
//reverse them back again
180
s->reorderBeams(newOrder);
181
QCOMPARE(s->numBeams(), 2);
182
QCOMPARE(s->lastValue(0), 1.0);
183
QCOMPARE(s->lastValue(1), 2.0);
185
//switch them yet again
186
s->reorderBeams(newOrder);
189
s->addBeam(Qt::green);
190
QCOMPARE(s->numBeams(), 3);
191
QCOMPARE(s->lastValue(0), 2.0);
192
QCOMPARE(s->lastValue(1), 1.0);
193
QVERIFY(isnan(s->lastValue(2))); //unset, so should default to NaN
196
newOrder << 2 << 0 << 1;
197
s->reorderBeams(newOrder);
198
QCOMPARE(s->numBeams(), 3);
199
QVERIFY(isnan(s->lastValue(0))); //unset, so should default to NaN
200
QCOMPARE(s->lastValue(1), 2.0);
201
QCOMPARE(s->lastValue(2), 1.0);
203
void TestSignalPlotter::testMaximumRange()
205
QCOMPARE(s->maximumValue(), 0.0);
206
QCOMPARE(s->minimumValue(), 0.0);
207
QCOMPARE(s->currentMaximumRangeValue(), 0.0);
208
QCOMPARE(s->currentMinimumRangeValue(), 0.0);
209
QCOMPARE(s->useAutoRange(), true);
211
s->addBeam(Qt::blue);
212
//Nothing should have changed yet
213
QCOMPARE(s->maximumValue(), 0.0);
214
QCOMPARE(s->minimumValue(), 0.0);
215
QCOMPARE(s->currentMaximumRangeValue(), 0.0);
216
QCOMPARE(s->currentMinimumRangeValue(), 0.0);
222
QCOMPARE(s->maximumValue(), 0.0);
223
QCOMPARE(s->minimumValue(), 0.0);
225
QCOMPARE(s->currentMaximumRangeValue(), 1.1); //It gets rounded up.
226
QCOMPARE(s->currentMinimumRangeValue(), 0.0);
227
QCOMPARE(s->currentAxisPrecision(), 2); //step is 0.22
229
s->setMaximumValue(1.0);
230
QCOMPARE(s->maximumValue(), 1.0);
231
QCOMPARE(s->minimumValue(), 0.0);
232
QCOMPARE(s->currentMaximumRangeValue(), 1.1); //Current value is still larger
233
QCOMPARE(s->currentMinimumRangeValue(), 0.0);
234
QCOMPARE(s->currentAxisPrecision(), 2);
236
s->setMaximumValue(1.4);
237
QCOMPARE(s->maximumValue(), 1.4);
238
QCOMPARE(s->minimumValue(), 0.0);
239
QCOMPARE(s->currentMaximumRangeValue(), 1.4); //given maximum range is now the larger value
240
QCOMPARE(s->currentMinimumRangeValue(), 0.0);
241
QCOMPARE(s->currentAxisPrecision(), 2);
245
//nothing changed by adding a beam
246
QCOMPARE(s->maximumValue(), 1.4);
247
QCOMPARE(s->minimumValue(), 0.0);
248
QCOMPARE(s->currentMaximumRangeValue(), 1.4); //given maximum range hasn't changed
249
QCOMPARE(s->currentMinimumRangeValue(), 0.0);
250
QCOMPARE(s->currentAxisPrecision(), 2);
253
void TestSignalPlotter::testNonZeroRange()
255
s->addBeam(Qt::blue);
256
s->setMinimumValue(10);
257
s->setMaximumValue(20);
259
QCOMPARE(s->currentMinimumRangeValue(), 10.0); //Current range should be 10, 12, 14, 16, 18, 20
260
QCOMPARE(s->currentMaximumRangeValue(), 20.0);
261
QCOMPARE(s->currentAxisPrecision(), 0);
263
s->addSample(QList<qreal>() << 15);
264
s->addSample(QList<qreal>() << 25);
265
s->addSample(QList<qreal>() << 5);
267
QCOMPARE(s->currentMinimumRangeValue(), 5.0);
268
QCOMPARE(s->currentMaximumRangeValue(), 25.0); //Current range should be 5, 9, 13, 17, 21, 25
269
QCOMPARE(s->currentAxisPrecision(), 0);
272
s->addSample(QList<qreal>() << 7 << 9);
273
s->addSample(QList<qreal>() << 29.8 << 2);
275
QCOMPARE(s->currentMinimumRangeValue(), 2.0);
276
QCOMPARE(s->currentMaximumRangeValue(), 30.0); //Current range should be 2, 7.6, 13.2, 18.8, 24.4, 30
277
QCOMPARE(s->currentAxisPrecision(), 1);
279
s->addSample(QList<qreal>() << std::numeric_limits<qreal>::quiet_NaN()); //These should appear as gaps in the data
281
QCOMPARE(s->currentMinimumRangeValue(), 2.0);
282
QCOMPARE(s->currentMaximumRangeValue(), 30.0);
283
QCOMPARE(s->currentAxisPrecision(), 1);
285
s->addSample(QList<qreal>() << 1.0/0.0 << -1.0/0.0);
287
QCOMPARE(s->currentMinimumRangeValue(), 2.0);
288
QCOMPARE(s->currentMaximumRangeValue(), 30.0);
289
QCOMPARE(s->currentAxisPrecision(), 1);
292
void TestSignalPlotter::testNonZeroRange2()
294
s->addBeam(Qt::blue);
295
s->setMinimumValue(22);
296
s->setMaximumValue(23);
298
QCOMPARE(s->currentMinimumRangeValue(), 22.0);
299
QCOMPARE(s->currentMaximumRangeValue(), 23.0);
301
s->addSample(QList<qreal>() << 25);
302
QCOMPARE(s->currentMinimumRangeValue(), 22.0);
303
QCOMPARE(s->currentMaximumRangeValue(), 25.0);
307
void TestSignalPlotter::testNiceRangeCalculation_data()
309
QTest::addColumn<qreal>("min");
310
QTest::addColumn<qreal>("max");
311
QTest::addColumn<qreal>("niceMin");
312
QTest::addColumn<qreal>("niceMax");
313
QTest::addColumn<int>("precision");
315
#define STRINGIZE(number) #number
316
#define testRange(min,max,niceMin,niceMax, precision) QTest::newRow(STRINGIZE(min) " to " STRINGIZE(max)) << qreal(min) << qreal(max) << qreal(niceMin) << qreal(niceMax) << int(precision)
317
/* testRange(-49, 199, -50, 200, 0); // Scale should read -50, 0, 50, 100, 150, 200
318
testRange(-50, 199, -50, 200, 0); // Scale should read -50, 0, 50, 100, 150, 200
319
testRange(-49, 200, -50, 200, 0); // Scale should read -50, 0, 50, 100, 150, 200
320
testRange(-50, 200, -50, 200, 0); // Scale should read -50, 0, 50, 100, 150, 200
321
testRange(-1, 199, -50, 200, 0); // Scale should read -50, 0, 50, 100, 150, 200
322
testRange(-99, 149, -100, 150, 0); // Scale should read -100, 50, 0, 50, 100, 150
323
testRange(-100, 150, -100, 150, 0); // Scale should read -100, 50, 0, 50, 100, 150
324
testRange(-1000, 1000, -1000, 1500, 0); // Scale should read -1000, 500, 0, 500, 1000, 1500 */
325
testRange(0, 7, 0, 7, 1); // Scale should read 0, 1.4, 2.8, 4.2, 5.6, 7
327
void TestSignalPlotter::testNiceRangeCalculation()
331
QFETCH(qreal, niceMin);
332
QFETCH(qreal, niceMax);
333
QFETCH(int, precision);
335
s->addBeam(Qt::blue);
336
s->changeRange(min, max);
338
QCOMPARE(s->currentMinimumRangeValue(), niceMin);
339
QCOMPARE(s->currentMaximumRangeValue(), niceMax);
340
QCOMPARE(s->currentAxisPrecision(), precision);
343
void TestSignalPlotter::testNegativeMinimumRange()
345
s->setMinimumValue(-1000);
346
s->setMaximumValue(4000);
347
QCOMPARE(s->minimumValue(), -1000.0);
348
QCOMPARE(s->maximumValue(), 4000.0);
349
QCOMPARE(s->currentMinimumRangeValue(), -1000.0);
350
QCOMPARE(s->currentMaximumRangeValue(), 4000.0);
352
s->setScaleDownBy(1024);
353
QCOMPARE(s->minimumValue(), -1000.0);
354
QCOMPARE(s->maximumValue(), 4000.0);
355
QCOMPARE(s->currentMaximumRangeValue(), 4014.08); //The given range was -0.976KB to 3.906KB. This was rounded as: -0.98KB to 3.92KB
356
QCOMPARE(s->currentMinimumRangeValue(), -1003.52);
358
QCOMPARE(s->valueAsString(4096,1), QString("4.0"));
359
QCOMPARE(s->valueAsString(-4096,1), QString("-4.0"));
362
s->addSample(QList<qreal>() << -1024.0);
363
QCOMPARE(s->currentMaximumRangeValue(), 4096.0);
364
QCOMPARE(s->currentMinimumRangeValue(), -1024.0);
365
s->addSample(QList<qreal>() << -1025.0); //Scale now becomes -3, -1.5, 0, 1.5, 3, 4.5 in KB
366
QCOMPARE(s->currentMinimumRangeValue(), -1126.4); //-1.1KB
367
QCOMPARE(s->currentMaximumRangeValue(), 4505.6); //4.4KB
369
void TestSignalPlotter::testSetBeamColor() {
371
s->setBeamColor(0, Qt::blue);
372
QVERIFY(s->beamColor(0) == Qt::blue);
373
QCOMPARE(s->numBeams(), 1);
376
QVERIFY(s->beamColor(0) == Qt::blue);
377
QVERIFY(s->beamColor(1) == Qt::red);
378
QCOMPARE(s->numBeams(), 2);
380
s->setBeamColor(0, Qt::green);
381
QVERIFY(s->beamColor(0) == Qt::green);
382
QVERIFY(s->beamColor(1) == Qt::red);
383
QCOMPARE(s->numBeams(), 2);
385
s->setBeamColor(1, Qt::blue);
386
QVERIFY(s->beamColor(0) == Qt::green);
387
QVERIFY(s->beamColor(1) == Qt::blue);
390
QVERIFY(s->beamColor(0) == Qt::blue);
391
s->setBeamColor(0, Qt::red);
392
QVERIFY(s->beamColor(0) == Qt::red);
395
void TestSignalPlotter::testSetUnit() {
397
QCOMPARE(s->valueAsString(3e20,1), QString("3e+20"));
398
QCOMPARE(s->valueAsString(-3e20,1), QString("-3e+20"));
400
s->setUnit(ki18ncp("Units", "%1 second", "%1 seconds") );
402
QCOMPARE(s->valueAsString(3e20,1), QString("3e+20 seconds"));
403
QCOMPARE(s->valueAsString(-3e20,1), QString("-3e+20 seconds"));
404
QCOMPARE(s->valueAsString(3.4,1), QString("3.4 seconds"));
405
QCOMPARE(s->valueAsString(-3.4,1), QString("-3.4 seconds"));
406
QCOMPARE(s->valueAsString(1), QString("1.0 seconds"));
407
QCOMPARE(s->valueAsString(-1), QString("-1.0 seconds"));
408
QCOMPARE(s->valueAsString(1,0), QString("1 second"));
409
QCOMPARE(s->valueAsString(-1,0), QString("-1 second"));
411
//now switch to minutes
412
s->setScaleDownBy(60);
413
s->setUnit(ki18ncp("Units", "%1 minute", "%1 minutes") );
414
QCOMPARE(s->valueAsString(3.4), QString("0.06 minutes"));
415
QCOMPARE(s->valueAsString(-3.4), QString("-0.06 minutes"));
416
QCOMPARE(s->valueAsString(60), QString("1.0 minutes"));
417
QCOMPARE(s->valueAsString(-60), QString("-1.0 minutes"));
418
QCOMPARE(s->valueAsString(60,0), QString("1 minute"));
419
QCOMPARE(s->valueAsString(-60,0), QString("-1 minute"));
422
void TestSignalPlotter::testGettersSetters() {
423
//basic test of all the getters and setters and default values
424
KLocalizedString string = ki18ncp("Units", "%1 second", "%1 seconds");
425
s->setUnit( string );
426
QVERIFY( s->unit().toString() == string.toString() );
427
s->setMaximumValue(3);
428
s->setMinimumValue(-3);
429
QCOMPARE(s->maximumValue(), 3.0);
430
QCOMPARE(s->minimumValue(), -3.0);
432
s->changeRange(-2,2);
433
QCOMPARE(s->maximumValue(), 2.0);
434
QCOMPARE(s->minimumValue(), -2.0);
436
s->setMinimumValue(-3);
437
QCOMPARE(s->useAutoRange(), true); //default
438
s->setUseAutoRange(false);
439
QCOMPARE(s->useAutoRange(), false);
441
QCOMPARE(s->scaleDownBy(), 1.0); //default
442
s->setScaleDownBy(1.2);
443
QCOMPARE(s->scaleDownBy(), 1.2);
444
s->setScaleDownBy(0.5);
445
QCOMPARE(s->scaleDownBy(), 0.5);
447
QCOMPARE(s->horizontalScale(), 6); //default
448
s->setHorizontalScale(2);
449
QCOMPARE(s->horizontalScale(), 2);
450
s->setHorizontalScale(1);
451
QCOMPARE(s->horizontalScale(), 1);
452
s->setHorizontalScale(0); // Ignored - invalid value
453
QCOMPARE(s->horizontalScale(), 1);
455
QCOMPARE(s->showHorizontalLines(), true); //default
456
s->setShowHorizontalLines(false);
457
QCOMPARE(s->showHorizontalLines(), false);
459
QCOMPARE(s->showVerticalLines(), false); //default
460
s->setShowVerticalLines(true);
461
QCOMPARE(s->showVerticalLines(), true);
463
QCOMPARE(s->verticalLinesScroll(), true); //default
464
s->setVerticalLinesScroll(false);
465
QCOMPARE(s->verticalLinesScroll(), false);
467
QCOMPARE(s->verticalLinesDistance(), (uint)30); //default
468
s->setVerticalLinesDistance(1);
469
QCOMPARE(s->verticalLinesDistance(), (uint)1);
471
QCOMPARE(s->showAxis(), true); //default
472
s->setShowAxis(false);
473
QCOMPARE(s->showAxis(), false);
475
QCOMPARE(s->maxAxisTextWidth(), 0); //default
476
s->setMaxAxisTextWidth(30);
477
QCOMPARE(s->maxAxisTextWidth(), 30);
478
s->setMaxAxisTextWidth(0);
479
QCOMPARE(s->maxAxisTextWidth(), 0);
481
QCOMPARE(s->smoothGraph(), true); //default
482
s->setSmoothGraph(false);
483
QCOMPARE(s->smoothGraph(), false);
485
QCOMPARE(s->stackGraph(), false); //default
486
s->setStackGraph(true);
487
QCOMPARE(s->stackGraph(), true);
489
QCOMPARE(s->fillOpacity(), 20); //default
490
s->setFillOpacity(255);
491
QCOMPARE(s->fillOpacity(), 255);
492
s->setFillOpacity(0);
493
QCOMPARE(s->fillOpacity(), 0);
497
void TestSignalPlotter::testAddingData()
499
QCOMPARE(s->useAutoRange(), true);
500
s->setGeometry(0,0,500,500);
501
//Test adding sample without any beams. It should just ignore this
502
s->addSample(QList<qreal>() << 1.0 << 2.0);
503
//Test setting the beam color of a non-existant beam. It should just ignore this too.
504
// s->setBeamColor(0, Qt::blue);
506
//Add an empty sample. This should just be ignored?
507
s->addSample(QList<qreal>());
509
//Okay let's be serious now
511
s->addSample(QList<qreal>() << 0.0);
512
s->addSample(QList<qreal>() << -0.0);
513
s->addSample(QList<qreal>() << -1.0);
514
s->addSample(QList<qreal>() << -1000.0);
515
s->addSample(QList<qreal>() << 1000.0);
516
s->addSample(QList<qreal>() << 300.0);
517
s->addSample(QList<qreal>() << 300.0);
518
s->addSample(QList<qreal>() << 300.0);
519
s->addSample(QList<qreal>() << 300.0);
520
s->addSample(QList<qreal>() << 300.0);
521
s->addSample(QList<qreal>() << 300.0);
522
s->addSample(QList<qreal>() << 1.0/0.0); //Positive infinity. Should be ignore for range values, not crash, and draw something reasonable
523
s->addSample(QList<qreal>() << 1.0/0.0); //Positive infinity. Should be ignore for range values, not crash, and draw something reasonable
524
s->addSample(QList<qreal>() << 1.0/0.0); //Positive infinity. Should be ignore for range values, not crash, and draw something reasonable
525
s->addSample(QList<qreal>() << 1.0/0.0); //Positive infinity. Should be ignore for range values, not crash, and draw something reasonable
526
s->addSample(QList<qreal>() << 1.0/0.0); //Positive infinity. Should be ignore for range values, not crash, and draw something reasonable
527
s->addSample(QList<qreal>() << -1.0/0.0); //Positive infinity. Likewise.
528
s->addSample(QList<qreal>() << -1.0/0.0); //Negative infinity. Likewise.
529
s->addSample(QList<qreal>() << -1.0/0.0); //Negative infinity. Likewise.
530
s->addSample(QList<qreal>() << -1.0/0.0); //Negative infinity. Likewise.
531
s->addSample(QList<qreal>() << -1.0/0.0); //Negative infinity. Likewise.
532
s->addSample(QList<qreal>() << -1.0/0.0); //Negative infinity. Likewise.
533
s->addSample(QList<qreal>() << 300.0);
534
s->addSample(QList<qreal>() << 300.0);
535
s->addSample(QList<qreal>() << 300.0);
536
s->addSample(QList<qreal>() << 300.0);
537
s->addSample(QList<qreal>() << std::numeric_limits<qreal>::quiet_NaN()); //These should appear as gaps in the data
538
s->addSample(QList<qreal>() << 300.0);
539
s->addSample(QList<qreal>() << 300.0);
540
s->addSample(QList<qreal>() << std::numeric_limits<qreal>::quiet_NaN());
541
s->addSample(QList<qreal>() << 400.0);
542
s->addSample(QList<qreal>() << std::numeric_limits<qreal>::quiet_NaN());
543
s->addSample(QList<qreal>() << std::numeric_limits<qreal>::quiet_NaN());
544
s->addBeam(Qt::green);
545
s->addSample(QList<qreal>() << std::numeric_limits<qreal>::quiet_NaN() << 100.0);
546
s->addSample(QList<qreal>() << std::numeric_limits<qreal>::quiet_NaN() << 100.0);
547
s->addSample(QList<qreal>() << 200.0 << 100.0);
548
s->addSample(QList<qreal>() << 300.0 << 100.0);
549
s->addBeam(Qt::blue);
550
s->addSample(QList<qreal>() << 400.0 << 100.0 << 200.0);
551
s->addSample(QList<qreal>() << 500.0 << 100.0 << 200.0);
552
s->addSample(QList<qreal>() << 600.0 << 100.0 << 200.0);
554
QCOMPARE(s->currentMinimumRangeValue(), -1000.0);
555
QCOMPARE(s->currentMaximumRangeValue(), 1500.0);
557
//Paint to a device, to check that the painter does not crash etc
558
QPixmap pixmap(s->size());
561
// For debugging, show the widget so that we can check it visually
563
// QTest::qWait(10000);
565
//Test that it does not crash at small sizes
566
for(int x = 0; x < 4; x++)
567
for(int y = 0; y < 4; y++) {
568
s->setGeometry(0,0,x,y);
572
QTEST_KDEMAIN(TestSignalPlotter, GUI)