Skip to content

Commit 09d6399

Browse files
committedSep 21, 2012
First simple test
1 parent 341935d commit 09d6399

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed
 

‎tests/src/gui/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,5 @@ ADD_QGIS_TEST(zoomtest testqgsmaptoolzoom.cpp)
119119

120120
ADD_QGIS_TEST(histogramtest testqgsrasterhistogram.cpp)
121121
ADD_QGIS_TEST(projectionissues testprojectionissues.cpp)
122+
ADD_QGIS_TEST(scalecombobox testqgsscalecombobox.cpp)
122123

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/***************************************************************************
2+
testqgsscalecombobox.cpp
3+
---------------------------
4+
begin : September 2012
5+
copyright : (C) 2012 by Magnus Homann
6+
email : magnus at homann dot se
7+
***************************************************************************/
8+
9+
/***************************************************************************
10+
* *
11+
* This program is free software; you can redistribute it and/or modify *
12+
* it under the terms of the GNU General Public License as published by *
13+
* the Free Software Foundation; either version 2 of the License, or *
14+
* (at your option) any later version. *
15+
* *
16+
***************************************************************************/
17+
18+
#include "qgsapplication.h"
19+
#include "qgsscalecombobox.h"
20+
#include <QObject>
21+
#include <QLineEdit>
22+
#include <QComboBox>
23+
#include <QtTest>
24+
25+
class TestQgsScaleComboBox: public QObject
26+
{
27+
Q_OBJECT;
28+
private slots:
29+
void initTestCase();// will be called before the first testfunction is executed.
30+
void cleanupTestCase();// will be called after the last testfunction was executed.
31+
void init();// will be called before each testfunction is executed.
32+
void cleanup();// will be called after every testfunction.
33+
void basic();
34+
private:
35+
QgsScaleComboBox *mScaleEdit;
36+
};
37+
38+
void TestQgsScaleComboBox::initTestCase()
39+
{
40+
QgsApplication::init();
41+
QgsApplication::initQgis();
42+
43+
// Create a combobox, and init with predefined scales.
44+
mScaleEdit = new QgsScaleComboBox();
45+
};
46+
47+
void TestQgsScaleComboBox::cleanupTestCase()
48+
{
49+
delete mScaleEdit;
50+
};
51+
52+
void TestQgsScaleComboBox::init()
53+
{
54+
};
55+
56+
void TestQgsScaleComboBox::basic()
57+
{
58+
mScaleEdit->lineEdit()->setText( "" );
59+
QTest::keyClicks( mScaleEdit->lineEdit(), "1:2345");
60+
QCOMPARE( mScaleEdit->lineEdit()->text(), QString("1:2345"));
61+
};
62+
63+
void TestQgsScaleComboBox::cleanup()
64+
{
65+
};
66+
67+
QTEST_MAIN( TestQgsScaleComboBox )
68+
#include "moc_testqgsscalecombobox.cxx"

0 commit comments

Comments
 (0)
Please sign in to comment.