@@ -21,6 +21,7 | |||||
21 | #include <QtTest/QtTest> |
|
21 | #include <QtTest/QtTest> | |
22 | #include <qlineseries.h> |
|
22 | #include <qlineseries.h> | |
23 | #include <qchartview.h> |
|
23 | #include <qchartview.h> | |
|
24 | #include <QStandardItemModel> | |||
24 |
|
25 | |||
25 | Q_DECLARE_METATYPE(QList<QPointF>) |
|
26 | Q_DECLARE_METATYPE(QList<QPointF>) | |
26 |
|
27 | |||
@@ -423,32 +424,44 void tst_QLineSeries::setModel() | |||||
423 | Q_DECLARE_METATYPE(Qt::Orientation) |
|
424 | Q_DECLARE_METATYPE(Qt::Orientation) | |
424 | void tst_QLineSeries::setModelMapping_data() |
|
425 | void tst_QLineSeries::setModelMapping_data() | |
425 | { |
|
426 | { | |
426 | #if 0 |
|
|||
427 | QTest::addColumn<int>("modelX"); |
|
427 | QTest::addColumn<int>("modelX"); | |
428 | QTest::addColumn<int>("modelY"); |
|
428 | QTest::addColumn<int>("modelY"); | |
429 | QTest::addColumn<Qt::Orientation>("orientation"); |
|
429 | QTest::addColumn<Qt::Orientation>("orientation"); | |
430 |
QTest::newRow(" |
|
430 | QTest::newRow("different x and y, vertical") << 0 << 1 << Qt::Vertical; | |
431 | #endif |
|
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 | void tst_QLineSeries::setModelMapping() |
|
439 | void tst_QLineSeries::setModelMapping() | |
435 | { |
|
440 | { | |
436 | #if 0 |
|
|||
437 | QFETCH(int, modelX); |
|
441 | QFETCH(int, modelX); | |
438 | QFETCH(int, modelY); |
|
442 | QFETCH(int, modelY); | |
439 | QFETCH(Qt::Orientation, orientation); |
|
443 | QFETCH(Qt::Orientation, orientation); | |
440 |
|
444 | |||
441 |
|
|
445 | QLineSeries series; | |
442 |
|
||||
443 | QSignalSpy spy0(&series, SIGNAL(clicked(QPointF const&))); |
|
|||
444 | QSignalSpy spy1(&series, SIGNAL(selected())); |
|
|||
445 |
|
446 | |||
|
447 | // model has not been set so setting mapping should do nothing | |||
446 | series.setModelMapping(modelX, modelY, orientation); |
|
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); |
|
453 | // now let us set the model | |
449 | QCOMPARE(spy1.count(), 0); |
|
454 | series.setModel(new QStandardItemModel()); | |
450 | #endif |
|
455 | series.setModelMapping(modelX, modelY, orientation); | |
451 | QSKIP("Test is not implemented.", SkipAll); |
|
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 | QTEST_MAIN(tst_QLineSeries) |
|
467 | QTEST_MAIN(tst_QLineSeries) |
General Comments 0
You need to be logged in to leave comments.
Login now