Skip to content

Commit

Permalink
Never use scientific notation
Browse files Browse the repository at this point in the history
  • Loading branch information
troopa81 committed Apr 30, 2019
1 parent b7772d4 commit 9cfaf10
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/gui/processing/qgsprocessingwidgetwrapperimpl.cpp
Expand Up @@ -2206,8 +2206,8 @@ void QgsProcessingPointPanel::clear()
void QgsProcessingPointPanel::setValue( const QgsPointXY &point, const QgsCoordinateReferenceSystem &crs ) void QgsProcessingPointPanel::setValue( const QgsPointXY &point, const QgsCoordinateReferenceSystem &crs )
{ {
QString newText = QStringLiteral( "%1,%2" ) QString newText = QStringLiteral( "%1,%2" )
.arg( QString::number( point.x(), 'g', 18 ) ) .arg( QString::number( point.x(), 'f' ) )
.arg( QString::number( point.y(), 'g', 18 ) ); .arg( QString::number( point.y(), 'f' ) );


mCrs = crs; mCrs = crs;
if ( mCrs.isValid() ) if ( mCrs.isValid() )
Expand Down
26 changes: 13 additions & 13 deletions tests/src/gui/testprocessinggui.cpp
Expand Up @@ -2834,15 +2834,15 @@ void TestProcessingGui::testPointPanel()
QSignalSpy spy( panel.get(), &QgsProcessingPointPanel::changed ); QSignalSpy spy( panel.get(), &QgsProcessingPointPanel::changed );


panel->setValue( QgsPointXY( 100, 150 ), QgsCoordinateReferenceSystem() ); panel->setValue( QgsPointXY( 100, 150 ), QgsCoordinateReferenceSystem() );
QCOMPARE( panel->value().toString(), QStringLiteral( "100,150" ) ); QCOMPARE( panel->value().toString(), QStringLiteral( "100.000000,150.000000" ) );
QCOMPARE( spy.count(), 1 ); QCOMPARE( spy.count(), 1 );


panel->setValue( QgsPointXY( 200, 250 ), QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:3111" ) ) ); panel->setValue( QgsPointXY( 200, 250 ), QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:3111" ) ) );
QCOMPARE( panel->value().toString(), QStringLiteral( "200,250 [EPSG:3111]" ) ); QCOMPARE( panel->value().toString(), QStringLiteral( "200.000000,250.000000 [EPSG:3111]" ) );
QCOMPARE( spy.count(), 2 ); QCOMPARE( spy.count(), 2 );


panel->setValue( QgsPointXY( 123456.123456789122, 654321.987654321012 ), QgsCoordinateReferenceSystem() ); panel->setValue( QgsPointXY( 123456.123456789, 654321.987654321 ), QgsCoordinateReferenceSystem() );
QCOMPARE( panel->value().toString(), QStringLiteral( "123456.123456789122,654321.987654321012" ) ); QCOMPARE( panel->value().toString(), QStringLiteral( "123456.123457,654321.987654" ) );
QCOMPARE( spy.count(), 3 ); QCOMPARE( spy.count(), 3 );


QVERIFY( !panel->mLineEdit->showClearButton() ); QVERIFY( !panel->mLineEdit->showClearButton() );
Expand All @@ -2856,7 +2856,7 @@ void TestProcessingGui::testPointPanel()
canvas.setDestinationCrs( QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:28356" ) ) ); canvas.setDestinationCrs( QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:28356" ) ) );
panel->setMapCanvas( &canvas ); panel->setMapCanvas( &canvas );
panel->updatePoint( QgsPointXY( 1.5, -3.5 ) ); panel->updatePoint( QgsPointXY( 1.5, -3.5 ) );
QCOMPARE( panel->value().toString(), QStringLiteral( "1.5,-3.5 [EPSG:28356]" ) ); QCOMPARE( panel->value().toString(), QStringLiteral( "1.500000,-3.500000 [EPSG:28356]" ) );
QCOMPARE( spy.count(), 5 ); QCOMPARE( spy.count(), 5 );


panel.reset(); panel.reset();
Expand All @@ -2879,8 +2879,8 @@ void TestProcessingGui::testPointWrapper()
QCOMPARE( spy.count(), 1 ); QCOMPARE( spy.count(), 1 );
if ( type != QgsProcessingGui::Modeler ) if ( type != QgsProcessingGui::Modeler )
{ {
QCOMPARE( wrapper.widgetValue().toString(), QStringLiteral( "1,2" ) ); QCOMPARE( wrapper.widgetValue().toString(), QStringLiteral( "1.000000,2.000000" ) );
QCOMPARE( static_cast< QgsProcessingPointPanel * >( wrapper.wrappedWidget() )->mLineEdit->text(), QStringLiteral( "1,2" ) ); QCOMPARE( static_cast< QgsProcessingPointPanel * >( wrapper.wrappedWidget() )->mLineEdit->text(), QStringLiteral( "1.000000,2.000000" ) );
} }
else else
{ {
Expand All @@ -2891,8 +2891,8 @@ void TestProcessingGui::testPointWrapper()
QCOMPARE( spy.count(), 2 ); QCOMPARE( spy.count(), 2 );
if ( type != QgsProcessingGui::Modeler ) if ( type != QgsProcessingGui::Modeler )
{ {
QCOMPARE( wrapper.widgetValue().toString(), QStringLiteral( "1,2 [EPSG:3111]" ) ); QCOMPARE( wrapper.widgetValue().toString(), QStringLiteral( "1.000000,2.000000 [EPSG:3111]" ) );
QCOMPARE( static_cast< QgsProcessingPointPanel * >( wrapper.wrappedWidget() )->mLineEdit->text(), QStringLiteral( "1,2 [EPSG:3111]" ) ); QCOMPARE( static_cast< QgsProcessingPointPanel * >( wrapper.wrappedWidget() )->mLineEdit->text(), QStringLiteral( "1.000000,2.000000 [EPSG:3111]" ) );
} }
else else
{ {
Expand Down Expand Up @@ -2939,8 +2939,8 @@ void TestProcessingGui::testPointWrapper()
QCOMPARE( spy2.count(), 1 ); QCOMPARE( spy2.count(), 1 );
if ( type != QgsProcessingGui::Modeler ) if ( type != QgsProcessingGui::Modeler )
{ {
QCOMPARE( static_cast< QgsProcessingPointPanel * >( wrapper2.wrappedWidget() )->mLineEdit->text(), QStringLiteral( "1,2" ) ); QCOMPARE( static_cast< QgsProcessingPointPanel * >( wrapper2.wrappedWidget() )->mLineEdit->text(), QStringLiteral( "1.000000,2.000000" ) );
QCOMPARE( wrapper2.widgetValue().toString(), QStringLiteral( "1,2" ) ); QCOMPARE( wrapper2.widgetValue().toString(), QStringLiteral( "1.000000,2.000000" ) );
} }
else else
{ {
Expand All @@ -2952,8 +2952,8 @@ void TestProcessingGui::testPointWrapper()
QCOMPARE( spy2.count(), 2 ); QCOMPARE( spy2.count(), 2 );
if ( type != QgsProcessingGui::Modeler ) if ( type != QgsProcessingGui::Modeler )
{ {
QCOMPARE( wrapper2.widgetValue().toString(), QStringLiteral( "1,2 [EPSG:3111]" ) ); QCOMPARE( wrapper2.widgetValue().toString(), QStringLiteral( "1.000000,2.000000 [EPSG:3111]" ) );
QCOMPARE( static_cast< QgsProcessingPointPanel * >( wrapper2.wrappedWidget() )->mLineEdit->text(), QStringLiteral( "1,2 [EPSG:3111]" ) ); QCOMPARE( static_cast< QgsProcessingPointPanel * >( wrapper2.wrappedWidget() )->mLineEdit->text(), QStringLiteral( "1.000000,2.000000 [EPSG:3111]" ) );
} }
else else
{ {
Expand Down

0 comments on commit 9cfaf10

Please sign in to comment.