Skip to content

Commit

Permalink
fix scalecombobox test
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed Oct 19, 2013
1 parent 82e6451 commit 8d947e2
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/src/gui/testqgsscalecombobox.cpp
Expand Up @@ -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
Expand All @@ -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 );

};
Expand Down

0 comments on commit 8d947e2

Please sign in to comment.