Skip to content
Permalink
Browse files

fix scalecombobox test

  • Loading branch information
alexbruy committed Oct 19, 2013
1 parent 82e6451 commit 8d947e2c86fbeecce58708233e16b5cfbc1f8b13
Showing with 7 additions and 7 deletions.
  1. +7 −7 tests/src/gui/testqgsscalecombobox.cpp
@@ -65,21 +65,21 @@ void TestQgsScaleComboBox::basic()
l->setText( "" );
QTest::keyClicks( l, "1:2345" );
QTest::keyClick( l, Qt::Key_Return );
QCOMPARE( s->scaleString(), QString( "1:2345" ) );
QCOMPARE( s->scaleString(), QString( "1:%1" ).arg( QLocale::system().toString( 2345 ) ) );
QCOMPARE( s->scale(), (( double ) 1.0 / ( double ) 2345.0 ) );

// Testing conversion from number to "1:x"
l->setText( "" );
QTest::keyClicks( l, QLocale::system().toString( 0.02 ) );
QTest::keyClick( l, Qt::Key_Return );
QCOMPARE( s->scaleString(), QString( "1:50" ) );
QCOMPARE( s->scaleString(), QString( "1:%1" ).arg( QLocale::system().toString( 50 ) ) );
QCOMPARE( s->scale(), ( double ) 0.02 );

// Testing conversion from number to "1:x"
l->setText( "" );
QTest::keyClicks( l, QLocale::system().toString( 42 ) );
QTest::keyClick( l, Qt::Key_Return );
QCOMPARE( s->scaleString(), QString( "1:42" ) );
QCOMPARE( s->scaleString(), QString( "1:%1" ).arg( QLocale::system().toString( 42 ) ) );
QCOMPARE( s->scale(), ( double ) 1.0 / ( double ) 42.0 );

// Testing rounding and conversion from illegal
@@ -91,22 +91,22 @@ void TestQgsScaleComboBox::basic()
l->setText( "" );
QTest::keyClicks( l, "1:x:2" );
QTest::keyClick( l, Qt::Key_Return );
QCOMPARE( s->scaleString(), QString( "1:4" ) );
QCOMPARE( s->scaleString(), QString( "1:%1" ).arg( QLocale::system().toString( 4 ) ) );
QCOMPARE( s->scale(), ( double ) 0.25 );

// Test setting programatically
s->setScale(( double ) 0.19 );
QCOMPARE( s->scaleString(), QString( "1:5" ) );
QCOMPARE( s->scaleString(), QString( "1:%1" ).arg( QLocale::system().toString( 5 ) ) );
QCOMPARE( s->scale(), ( double ) 0.2 );

// Test setting programatically
s->setScaleString( QString( "1:240" ) );
QCOMPARE( s->scaleString(), QString( "1:240" ) );
QCOMPARE( s->scaleString(), QString( "1:%1" ).arg( QLocale::system().toString( 240 ) ) );
QCOMPARE( s->scale(), ( double ) 1.0 / ( double ) 240.0 );

// Test setting programatically illegal string
s->setScaleString( QString( "1:2.4" ) );
QCOMPARE( s->scaleString(), QString( "1:240" ) );
QCOMPARE( s->scaleString(), QString( "1:%1" ).arg( QLocale::system().toString( 240 ) ) );
QCOMPARE( s->scale(), ( double ) 1.0 / ( double ) 240.0 );

};

0 comments on commit 8d947e2

Please sign in to comment.
You can’t perform that action at this time.