mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-01 00:46:20 -05:00
add test to ensure scale lock is respected on canvas resize
This commit is contained in:
parent
2872665365
commit
a98e7a141a
@ -54,6 +54,7 @@ class TestQgsMapCanvas : public QObject
|
||||
void testMagnification();
|
||||
void testMagnificationExtent();
|
||||
void testMagnificationScale();
|
||||
void testScaleLockCanvasResize();
|
||||
void testZoomByWheel();
|
||||
void testShiftZoom();
|
||||
|
||||
@ -300,6 +301,27 @@ void TestQgsMapCanvas::testMagnificationScale()
|
||||
QCOMPARE( initialScale, mCanvas->scale() );
|
||||
}
|
||||
|
||||
void TestQgsMapCanvas::testScaleLockCanvasResize()
|
||||
{
|
||||
mCanvas->resize( 600, 400 );
|
||||
QCOMPARE( mCanvas->width(), 600 );
|
||||
QCOMPARE( mCanvas->height(), 400 );
|
||||
|
||||
mCanvas->setMagnificationFactor( 2.0 );
|
||||
double initialScale = mCanvas->scale();
|
||||
mCanvas->setScaleLocked( true );
|
||||
|
||||
mCanvas->resize( 300, 200 );
|
||||
QCOMPARE( mCanvas->width(), 300 );
|
||||
QCOMPARE( mCanvas->height(), 200 );
|
||||
|
||||
QCOMPARE( mCanvas->magnificationFactor(), 2.0 );
|
||||
QCOMPARE( mCanvas->scale(), initialScale );
|
||||
|
||||
mCanvas->setScaleLocked( false );
|
||||
mCanvas->setMagnificationFactor( 1.0 );
|
||||
}
|
||||
|
||||
void TestQgsMapCanvas::testZoomByWheel()
|
||||
{
|
||||
mCanvas->setExtent( QgsRectangle( 0, 0, 10, 10 ) );
|
||||
|
Loading…
x
Reference in New Issue
Block a user