Skip to content
Permalink
Browse files

apply different test depend on Qt version

  • Loading branch information
SebastienPeillet authored and mhugo committed Jan 7, 2020
1 parent 7b18909 commit 84563cb2c57222f2b7e171bfb785388d6314c731
Showing with 10 additions and 2 deletions.
  1. +10 −2 tests/src/core/testqgsfield.cpp
@@ -412,11 +412,19 @@ void TestQgsField::displayString()
customEnglish.setNumberOptions( QLocale::NumberOption::OmitGroupSeparator );
QLocale::setDefault( customEnglish );
QCOMPARE( doubleField.displayString( 5.005005 ), QString( "5.005" ) );
//QCOMPARE( doubleField.displayString( 4.5e-09 ), QString( "4.5e-9" ) ); //for recent qt package the expected value would be "4.5e-09"
#if QT_VERSION >= QT_VERSION_CHECK( 5, 11, 0 )
QCOMPARE( doubleField.displayString( 4.5e-09 ), QString( "4.5e-09" ) );
#else
QCOMPARE( doubleField.displayString( 4.5e-09 ), QString( "4.5e-9" ) );
#endif
QCOMPARE( doubleField.displayString( 1e-04 ), QString( "0.0001" ) );
QCOMPARE( doubleFieldNoPrec.displayString( 5.005005 ), QString( "5.005005" ) );
QCOMPARE( doubleFieldNoPrec.displayString( 5.005005005 ), QString( "5.005005005" ) );
//QCOMPARE( doubleFieldNoPrec.displayString( 4.5e-09 ), QString( "4.5e-9" ) ); //for recent qt package the expected value would be "4.5e-09"
#if QT_VERSION >= QT_VERSION_CHECK( 5, 11, 0 )
QCOMPARE( doubleFieldNoPrec.displayString( 4.5e-09 ), QString( "4.5e-09" ) );
#else
QCOMPARE( doubleFieldNoPrec.displayString( 4.5e-09 ), QString( "4.5e-9" ) );
#endif
QCOMPARE( doubleFieldNoPrec.displayString( 1e-04 ), QString( "0.0001" ) );
QCOMPARE( doubleFieldNoPrec.displayString( 599999898999.0 ), QString( "599999898999" ) );
QCOMPARE( doubleFieldNoPrec.displayString( 5999.123456 ), QString( "5999.123456" ) );

0 comments on commit 84563cb

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