Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix scale list (#52414)
* fix scale list

fixes #52383

* add test

* Update qgsscalecombobox.cpp
  • Loading branch information
3nids committed Mar 28, 2023
1 parent 346abae commit 0a387cc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/gui/qgsscalecombobox.cpp
Expand Up @@ -44,7 +44,7 @@ void QgsScaleComboBox::updateScales( const QStringList &scales )

if ( scales.isEmpty() )
{
const QStringList scales = QgsSettingsRegistryCore::settingsMapScales->value();
myScalesList = QgsSettingsRegistryCore::settingsMapScales->value();
}
else
{
Expand Down
9 changes: 9 additions & 0 deletions tests/src/gui/testqgsscalecombobox.cpp
Expand Up @@ -18,6 +18,7 @@
#include "qgsapplication.h"
#include "qgslogger.h"
#include "qgsscalecombobox.h"
#include "qgssettingsregistrycore.h"
#include <QObject>
#include <QLineEdit>
#include <QComboBox>
Expand Down Expand Up @@ -70,6 +71,14 @@ void TestQgsScaleComboBox::init()

void TestQgsScaleComboBox::basic()
{
const QStringList scales = QgsSettingsRegistryCore::settingsMapScales->value();
QCOMPARE( scales.count(), s->count() );
for ( int i = 0; i < s->count(); i++ )
{
int denominator = QLocale().toInt( scales[i].split( ':' )[1] );
QCOMPARE( s->itemText( i ), QString( "1:%1" ).arg( QLocale().toString( denominator ) ) );
}

// Testing conversion from "1:nnn".
enterScale( QStringLiteral( "1:2345" ) );
QCOMPARE( s->scaleString(), QString( "1:%1" ).arg( QLocale().toString( 2345 ) ) );
Expand Down

0 comments on commit 0a387cc

Please sign in to comment.