mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-06 00:07:29 -04:00
fix scale list (#52414)
* fix scale list fixes #52383 * add test * Update qgsscalecombobox.cpp
This commit is contained in:
parent
346abae549
commit
0a387cc213
@ -44,7 +44,7 @@ void QgsScaleComboBox::updateScales( const QStringList &scales )
|
||||
|
||||
if ( scales.isEmpty() )
|
||||
{
|
||||
const QStringList scales = QgsSettingsRegistryCore::settingsMapScales->value();
|
||||
myScalesList = QgsSettingsRegistryCore::settingsMapScales->value();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "qgsapplication.h"
|
||||
#include "qgslogger.h"
|
||||
#include "qgsscalecombobox.h"
|
||||
#include "qgssettingsregistrycore.h"
|
||||
#include <QObject>
|
||||
#include <QLineEdit>
|
||||
#include <QComboBox>
|
||||
@ -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 ) ) );
|
||||
|
Loading…
x
Reference in New Issue
Block a user