Skip to content

Commit

Permalink
First simple test
Browse files Browse the repository at this point in the history
  • Loading branch information
homann committed Sep 21, 2012
1 parent 341935d commit 09d6399
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/src/gui/CMakeLists.txt
Expand Up @@ -119,4 +119,5 @@ ADD_QGIS_TEST(zoomtest testqgsmaptoolzoom.cpp)

ADD_QGIS_TEST(histogramtest testqgsrasterhistogram.cpp)
ADD_QGIS_TEST(projectionissues testprojectionissues.cpp)
ADD_QGIS_TEST(scalecombobox testqgsscalecombobox.cpp)

68 changes: 68 additions & 0 deletions tests/src/gui/testqgsscalecombobox.cpp
@@ -0,0 +1,68 @@
/***************************************************************************
testqgsscalecombobox.cpp
---------------------------
begin : September 2012
copyright : (C) 2012 by Magnus Homann
email : magnus at homann dot se
***************************************************************************/

/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#include "qgsapplication.h"
#include "qgsscalecombobox.h"
#include <QObject>
#include <QLineEdit>
#include <QComboBox>
#include <QtTest>

class TestQgsScaleComboBox: public QObject
{
Q_OBJECT;
private slots:
void initTestCase();// will be called before the first testfunction is executed.
void cleanupTestCase();// will be called after the last testfunction was executed.
void init();// will be called before each testfunction is executed.
void cleanup();// will be called after every testfunction.
void basic();
private:
QgsScaleComboBox *mScaleEdit;
};

void TestQgsScaleComboBox::initTestCase()
{
QgsApplication::init();
QgsApplication::initQgis();

// Create a combobox, and init with predefined scales.
mScaleEdit = new QgsScaleComboBox();
};

void TestQgsScaleComboBox::cleanupTestCase()
{
delete mScaleEdit;
};

void TestQgsScaleComboBox::init()
{
};

void TestQgsScaleComboBox::basic()
{
mScaleEdit->lineEdit()->setText( "" );
QTest::keyClicks( mScaleEdit->lineEdit(), "1:2345");
QCOMPARE( mScaleEdit->lineEdit()->text(), QString("1:2345"));
};

void TestQgsScaleComboBox::cleanup()
{
};

QTEST_MAIN( TestQgsScaleComboBox )
#include "moc_testqgsscalecombobox.cxx"

0 comments on commit 09d6399

Please sign in to comment.