##// END OF EJS Templates
Adds tst_qchartview draft
Michal Klocek -
r774:de60163b4c1f
parent child
Show More
@@ -0,0 +1,4
1 !include( ../../test.pri ) {
2 error( "Couldn't find the test.pri file!" )
3 }
4 SOURCES += tst_qchartview.cpp No newline at end of file
@@ -0,0 +1,117
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
14 **
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
18 **
19 ****************************************************************************/
20
21
22 #include <QtTest/QtTest>
23 #include <qchartview.h>
24
25 QTCOMMERCIALCHART_USE_NAMESPACE
26
27
28 Q_DECLARE_METATYPE(QChart*)
29 Q_DECLARE_METATYPE(QChartView::RubberBands)
30
31 class tst_QChartView : public QObject
32 {
33 Q_OBJECT
34
35 public Q_SLOTS:
36 void initTestCase();
37 void cleanupTestCase();
38 void init();
39 void cleanup();
40
41 private Q_SLOTS:
42 void qchartview_data();
43 void qchartview();
44
45 void chart_data();
46 void chart();
47 void rubberBand_data();
48 void rubberBand();
49
50 private:
51 QChartView* m_view;
52 };
53
54 void tst_QChartView::initTestCase()
55 {
56 }
57
58 void tst_QChartView::cleanupTestCase()
59 {
60 }
61
62 void tst_QChartView::init()
63 {
64 m_view = new QChartView(new QChart());
65 }
66
67 void tst_QChartView::cleanup()
68 {
69 delete m_view;
70 m_view =0;
71 }
72
73 void tst_QChartView::qchartview_data()
74 {
75
76 }
77
78 void tst_QChartView::qchartview()
79 {
80 QVERIFY(m_view->chart());
81 QCOMPARE(m_view->rubberBand(), QChartView::NoRubberBand);
82 QTest::qWaitForWindowShown(m_view);
83 }
84
85 void tst_QChartView::chart_data()
86 {
87
88 QTest::addColumn<QChart*>("chart");
89 QTest::newRow("qchart") << new QChart();
90 }
91
92 void tst_QChartView::chart()
93 {
94 QFETCH(QChart*, chart);
95 QChartView* view = new QChartView(chart);
96 QCOMPARE(view->chart(), chart);
97 delete view;
98 }
99
100 void tst_QChartView::rubberBand_data()
101 {
102 QTest::addColumn<QChartView::RubberBands>("rubberBand");
103 QTest::newRow("HorizonalRubberBand") << QChartView::RubberBands(QChartView::HorizonalRubberBand);
104 QTest::newRow("VerticalRubberBand") << QChartView::RubberBands(QChartView::VerticalRubberBand);
105 QTest::newRow("RectangleRubberBand") << QChartView::RubberBands(QChartView::RectangleRubberBand);
106 }
107
108 void tst_QChartView::rubberBand()
109 {
110 QFETCH(QChartView::RubberBands, rubberBand);
111 m_view->setRubberBand(rubberBand);
112 QCOMPARE(m_view->rubberBand(), rubberBand);
113 }
114
115 QTEST_MAIN(tst_QChartView)
116 #include "tst_qchartview.moc"
117
@@ -1,2 +1,2
1 TEMPLATE = subdirs
1 TEMPLATE = subdirs
2 SUBDIRS += chartdataset domain No newline at end of file
2 SUBDIRS += chartdataset domain qchartview No newline at end of file
@@ -1,3 +1,23
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
14 **
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
18 **
19 ****************************************************************************/
20
1 #include <QtTest/QtTest>
21 #include <QtTest/QtTest>
2 #include <private/domain_p.h>
22 #include <private/domain_p.h>
3 #include <qchartaxis.h>
23 #include <qchartaxis.h>
@@ -11,13 +31,13 class tst_Domain: public QObject
11 {
31 {
12 Q_OBJECT
32 Q_OBJECT
13
33
14 public slots:
34 public Q_SLOTS:
15 void initTestCase();
35 void initTestCase();
16 void cleanupTestCase();
36 void cleanupTestCase();
17 void init();
37 void init();
18 void cleanup();
38 void cleanup();
19
39
20 private slots:
40 private Q_SLOTS:
21 void domain();
41 void domain();
22 void handleAxisRangeXChanged_data();
42 void handleAxisRangeXChanged_data();
23 void handleAxisRangeXChanged();
43 void handleAxisRangeXChanged();
General Comments 0
You need to be logged in to leave comments. Login now