@@ -49,7 +49,7 unix:coverage:{ | |||||
49 |
|
49 | |||
50 | runcoverage.target = run_coverage |
|
50 | runcoverage.target = run_coverage | |
51 | runcoverage.depends = buildcoverage |
|
51 | runcoverage.depends = buildcoverage | |
52 |
runcoverage.commands = for f in `ls ./bin/ |
|
52 | runcoverage.commands = for f in `ls ./bin/tst_*` ; do echo "processing \$\$f test..."; \$\$f >> unit.log; done ; | |
53 |
|
53 | |||
54 | gencoverage.target = gen_coverage |
|
54 | gencoverage.target = gen_coverage | |
55 | gencoverage.depends = runcoverage |
|
55 | gencoverage.depends = runcoverage |
@@ -20,6 +20,7 | |||||
20 |
|
20 | |||
21 | #include <QtTest/QtTest> |
|
21 | #include <QtTest/QtTest> | |
22 | #include <qlineseries.h> |
|
22 | #include <qlineseries.h> | |
|
23 | #include <qxymodelmapper.h> | |||
23 | #include <qchartview.h> |
|
24 | #include <qchartview.h> | |
24 | #include <QStandardItemModel> |
|
25 | #include <QStandardItemModel> | |
25 | #include <tst_definitions.h> |
|
26 | #include <tst_definitions.h> | |
@@ -125,36 +126,36 void tst_QLineSeries::qlineseries_data() | |||||
125 |
|
126 | |||
126 | void tst_QLineSeries::qlineseries() |
|
127 | void tst_QLineSeries::qlineseries() | |
127 | { |
|
128 | { | |
128 |
|
|
129 | QLineSeries series; | |
129 |
|
130 | |||
130 |
|
|
131 | QCOMPARE(series.count(),0); | |
131 |
|
|
132 | QCOMPARE(series.brush(), QBrush()); | |
132 |
|
|
133 | QCOMPARE(series.points(), QList<QPointF>()); | |
133 |
|
|
134 | QCOMPARE(series.pen(), QPen()); | |
134 |
|
|
135 | QCOMPARE(series.pointsVisible(), false); | |
135 |
|
136 | |||
136 |
|
|
137 | series.append(QList<QPointF>()); | |
137 |
|
|
138 | series.append(0.0,0.0); | |
138 |
|
|
139 | series.append(QPointF()); | |
139 |
|
140 | |||
140 |
|
|
141 | series.remove(0.0,0.0); | |
141 |
|
|
142 | series.remove(QPointF()); | |
142 |
|
|
143 | series.removeAll(); | |
143 |
|
144 | |||
144 |
|
|
145 | series.replace(QPointF(),QPointF()); | |
145 |
|
|
146 | series.replace(0,0,0,0); | |
146 |
|
|
147 | series.setBrush(QBrush()); | |
147 |
|
148 | |||
148 | // QCOMPARE(series.setModel((QAbstractItemModel*)0), false); |
|
149 | // QCOMPARE(series.setModel((QAbstractItemModel*)0), false); | |
149 |
|
150 | |||
150 | // series.setModelMapping(-1, -1, Qt::Orientation(0)); |
|
151 | // series.setModelMapping(-1, -1, Qt::Orientation(0)); | |
151 |
|
152 | |||
152 |
|
|
153 | series.setPen(QPen()); | |
153 |
|
|
154 | series.setPointsVisible(false); | |
154 |
|
155 | |||
155 |
|
|
156 | m_chart->addSeries(&series); | |
156 |
|
|
157 | m_view->show(); | |
157 |
|
|
158 | QTest::qWaitForWindowShown(m_view); | |
158 | } |
|
159 | } | |
159 |
|
160 | |||
160 | void tst_QLineSeries::append_data() |
|
161 | void tst_QLineSeries::append_data() | |
@@ -490,20 +491,25 void tst_QLineSeries::setModelMapping_data() | |||||
490 |
|
491 | |||
491 | void tst_QLineSeries::setModelMapping() |
|
492 | void tst_QLineSeries::setModelMapping() | |
492 | { |
|
493 | { | |
493 | QSKIP("Model mapping has been rewriten, test case needs update", SkipAll); |
|
494 | // QSKIP("Model mapping has been rewriten, test case needs update", SkipAll); | |
494 |
|
495 | |||
495 |
|
|
496 | QFETCH(int, modelX); | |
496 |
|
|
497 | QFETCH(int, modelY); | |
497 |
|
|
498 | QFETCH(Qt::Orientation, orientation); | |
498 |
|
499 | |||
499 |
|
|
500 | QLineSeries series; | |
500 |
|
501 | |||
501 | // // model has not been set so setting mapping should do nothing |
|
502 | QXYModelMapper *mapper = new QXYModelMapper; | |
502 | // series.setModelMapping(modelX, modelY, orientation); |
|
503 | mapper->setMapX(modelX); | |
503 | // QCOMPARE(series.mapX(), -1); |
|
504 | mapper->setMapY(modelY); | |
504 | // QCOMPARE(series.mapY(), -1); |
|
505 | mapper->setOrientation(orientation); | |
505 | // QVERIFY2(series.mapOrientation() == Qt::Vertical, "The orientation by default should be Qt::Vertical"); |
|
|||
506 |
|
506 | |||
|
507 | QCOMPARE(mapper->mapX(), modelX); | |||
|
508 | QCOMPARE(mapper->mapY(), modelY); | |||
|
509 | QCOMPARE(mapper->orientation(), orientation); | |||
|
510 | // QVERIFY2(mapper->orientation() == Qt::Vertical, "The orientation by default should be Qt::Vertical"); | |||
|
511 | ||||
|
512 | // series.setModelMapper(mapper); | |||
507 | // // now let us set the model |
|
513 | // // now let us set the model | |
508 | // series.setModel(new QStandardItemModel()); |
|
514 | // series.setModel(new QStandardItemModel()); | |
509 | // series.setModelMapping(modelX, modelY, orientation); |
|
515 | // series.setModelMapping(modelX, modelY, orientation); | |
@@ -536,50 +542,55 void tst_QLineSeries::setModelMappingRange_data() | |||||
536 |
|
542 | |||
537 | void tst_QLineSeries::setModelMappingRange() |
|
543 | void tst_QLineSeries::setModelMappingRange() | |
538 | { |
|
544 | { | |
539 | QSKIP("Model mapping has been rewriten, test case needs update", SkipAll); |
|
545 | // QSKIP("Model mapping has been rewriten, test case needs update", SkipAll); | |
540 |
|
||||
541 | // QFETCH(int, first); |
|
|||
542 | // QFETCH(int, count); |
|
|||
543 | // QLineSeries series; |
|
|||
544 |
|
||||
545 | // QStandardItemModel *model = new QStandardItemModel(0, 2); |
|
|||
546 | // series.setModel(model); |
|
|||
547 | // series.setModelMapping(0, 1); |
|
|||
548 | // series.setModelMappingRange(first, count); |
|
|||
549 |
|
||||
550 | // QCOMPARE(series.mapFirst(), qMax(first, 0)); // regardles of what value was used to set the range, first should not be less than 0 |
|
|||
551 | // QCOMPARE(series.mapCount(), qMax(count, -1)); // regardles of what value was used to set the range, first should not be less than 0 |
|
|||
552 | // QVERIFY2(series.count() == 0, "No rows in the model, count should be 0"); |
|
|||
553 |
|
546 | |||
554 | // for (int row = 0; row < 3; ++row) { |
|
547 | QFETCH(int, first); | |
555 | // for (int column = 0; column < 2; column++) { |
|
548 | QFETCH(int, count); | |
556 | // QStandardItem *item = new QStandardItem(row * column); |
|
549 | QLineSeries series; | |
557 | // model->setItem(row, column, item); |
|
|||
558 | // } |
|
|||
559 | // } |
|
|||
560 | // if (qMax(count, -1) != -1) |
|
|||
561 | // QVERIFY2(series.count() == qMin(model->rowCount() - qMax(first, 0), qMax(count, -1)), "Count should be the number of items in a model after first item, but not more than count and not less than 0"); |
|
|||
562 | // else |
|
|||
563 | // QVERIFY2(series.count() == model->rowCount() - qMax(first, 0), "Count should be the number of items in a model after first item, but not less then 0"); |
|
|||
564 |
|
550 | |||
565 | // // let's add few more rows to the model |
|
551 | QXYModelMapper *mapper = new QXYModelMapper; | |
566 | // for (int row = 0; row < 10; ++row) { |
|
552 | mapper->setMapX(0); | |
567 | // QList<QStandardItem *> newRow; |
|
553 | mapper->setMapY(1); | |
568 | // for (int column = 0; column < 2; column++) { |
|
554 | mapper->setFirst(first); | |
569 | // newRow.append(new QStandardItem(row * column)); |
|
555 | mapper->setCount(count); | |
570 | // } |
|
556 | ||
571 | // model->appendRow(newRow); |
|
557 | QCOMPARE(mapper->first(), qMax(first, 0)); // regardles of what value was used in setFirst function, first should not be less than 0 | |
572 | // } |
|
558 | QCOMPARE(mapper->count(), qMax(count, -1)); // regardles of what value was used setCount function, count should not be less than -1 | |
573 | // if (qMax(count, -1) != -1) |
|
559 | ||
574 | // QVERIFY2(series.count() == qMin(model->rowCount() - qMax(first, 0), qMax(count, -1)), "Count should be the number of items in a model after first item, but not more than count, but not more than count and not less than 0"); |
|
560 | QStandardItemModel *model = new QStandardItemModel(0, 2); | |
575 | // else |
|
561 | series.setModel(model); | |
576 | // QVERIFY2(series.count() == model->rowCount() - qMax(first, 0), "Count should be the number of items in a model after first item, but not less then 0"); |
|
562 | series.setModelMapper(mapper); | |
|
563 | QVERIFY2(series.count() == 0, "No rows in the model, count should be 0"); | |||
|
564 | ||||
|
565 | for (int row = 0; row < 3; ++row) { | |||
|
566 | for (int column = 0; column < 2; column++) { | |||
|
567 | QStandardItem *item = new QStandardItem(row * column); | |||
|
568 | model->setItem(row, column, item); | |||
|
569 | } | |||
|
570 | } | |||
|
571 | if (qMax(count, -1) != -1) | |||
|
572 | QVERIFY2(series.count() == qMin(model->rowCount() - qMax(first, 0), qMax(count, -1)), "Count should be the number of items in a model after first item, but not more than count and not less than 0"); | |||
|
573 | else | |||
|
574 | QVERIFY2(series.count() == model->rowCount() - qMax(first, 0), "Count should be the number of items in a model after first item, but not less then 0"); | |||
|
575 | ||||
|
576 | // let's add few more rows to the model | |||
|
577 | for (int row = 0; row < 10; ++row) { | |||
|
578 | QList<QStandardItem *> newRow; | |||
|
579 | for (int column = 0; column < 2; column++) { | |||
|
580 | newRow.append(new QStandardItem(row * column)); | |||
|
581 | } | |||
|
582 | model->appendRow(newRow); | |||
|
583 | } | |||
|
584 | if (qMax(count, -1) != -1) | |||
|
585 | QVERIFY2(series.count() == qMin(model->rowCount() - qMax(first, 0), qMax(count, -1)), "Count should be the number of items in a model after first item, but not more than count, but not more than count and not less than 0"); | |||
|
586 | else | |||
|
587 | QVERIFY2(series.count() == model->rowCount() - qMax(first, 0), "Count should be the number of items in a model after first item, but not less then 0"); | |||
577 |
|
588 | |||
578 |
|
|
589 | // unset the model, values should be default | |
579 |
|
|
590 | series.setModel(0); | |
580 | // QCOMPARE(series.mapFirst(), 0); |
|
591 | // QCOMPARE(series.mapFirst(), 0); | |
581 | // QCOMPARE(series.mapCount(), -1); |
|
592 | // QCOMPARE(series.mapCount(), -1); | |
582 |
|
|
593 | QVERIFY2(series.count() == 0, "No rows in the model, count should be 0"); | |
583 | } |
|
594 | } | |
584 |
|
595 | |||
585 | void tst_QLineSeries::modelUpdated() |
|
596 | void tst_QLineSeries::modelUpdated() |
General Comments 0
You need to be logged in to leave comments.
Login now