##// END OF EJS Templates
Added test case to tst_qlineseries
Marek Rosa -
r1071:da6f7932fa27
parent child
Show More
@@ -21,6 +21,7
21 21 #include <QtTest/QtTest>
22 22 #include <qlineseries.h>
23 23 #include <qchartview.h>
24 #include <QStandardItemModel>
24 25
25 26 Q_DECLARE_METATYPE(QList<QPointF>)
26 27
@@ -423,32 +424,44 void tst_QLineSeries::setModel()
423 424 Q_DECLARE_METATYPE(Qt::Orientation)
424 425 void tst_QLineSeries::setModelMapping_data()
425 426 {
426 #if 0
427 427 QTest::addColumn<int>("modelX");
428 428 QTest::addColumn<int>("modelY");
429 429 QTest::addColumn<Qt::Orientation>("orientation");
430 QTest::newRow("null") << 0 << 0 << Qt::Orientation();
431 #endif
430 QTest::newRow("different x and y, vertical") << 0 << 1 << Qt::Vertical;
431 QTest::newRow("same x and y, vertical") << 0 << 0 << Qt::Vertical;
432 QTest::newRow("invalid x, corrent y, vertical") << -1 << 1 << Qt::Vertical;
433
434 QTest::newRow("different x and y, horizontal") << 0 << 1 << Qt::Horizontal;
435 QTest::newRow("same x and y, horizontal") << 0 << 0 << Qt::Horizontal;
436 QTest::newRow("invalid x, corrent y, horizontal") << -1 << 1 << Qt::Horizontal;
432 437 }
433 438
434 439 void tst_QLineSeries::setModelMapping()
435 440 {
436 #if 0
437 441 QFETCH(int, modelX);
438 442 QFETCH(int, modelY);
439 443 QFETCH(Qt::Orientation, orientation);
440 444
441 SubQXYSeries series;
442
443 QSignalSpy spy0(&series, SIGNAL(clicked(QPointF const&)));
444 QSignalSpy spy1(&series, SIGNAL(selected()));
445 QLineSeries series;
445 446
447 // model has not been set so setting mapping should do nothing
446 448 series.setModelMapping(modelX, modelY, orientation);
449 QCOMPARE(series.mapX(), -1);
450 QCOMPARE(series.mapY(), -1);
451 QVERIFY2(series.mapOrientation() == Qt::Vertical, "The orientation by default should be Qt::Vertical");
447 452
448 QCOMPARE(spy0.count(), 0);
449 QCOMPARE(spy1.count(), 0);
450 #endif
451 QSKIP("Test is not implemented.", SkipAll);
453 // now let us set the model
454 series.setModel(new QStandardItemModel());
455 series.setModelMapping(modelX, modelY, orientation);
456 QCOMPARE(series.mapX(), modelX);
457 QCOMPARE(series.mapY(), modelY);
458 QVERIFY2(series.mapOrientation() == orientation, "not good");
459
460 // now let us remove the model, the values should go back to default ones.
461 series.setModel(0);
462 QCOMPARE(series.mapX(), -1);
463 QCOMPARE(series.mapY(), -1);
464 QVERIFY2(series.mapOrientation() == Qt::Vertical, "The orientation by default should be Qt::Vertical");
452 465 }
453 466
454 467 QTEST_MAIN(tst_QLineSeries)
General Comments 0
You need to be logged in to leave comments. Login now