Skip to content
Permalink
Browse files

First simple test

  • Loading branch information
homann committed Sep 21, 2012
1 parent 341935d commit 09d6399b23da3eede449336afc03e89d84f107d9
Showing with 69 additions and 0 deletions.
  1. +1 −0 tests/src/gui/CMakeLists.txt
  2. +68 −0 tests/src/gui/testqgsscalecombobox.cpp
@@ -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)

@@ -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.
You can’t perform that action at this time.