mirror of
https://github.com/qgis/QGIS.git
synced 2025-06-19 00:02:48 -04:00
fix scalecombobox test
This commit is contained in:
parent
82e6451671
commit
8d947e2c86
@ -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 );
|
||||
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user