@@ -54,6 +54,7 @@ class TestQgsMapCanvas : public QObject
54
54
void testMagnification ();
55
55
void testMagnificationExtent ();
56
56
void testMagnificationScale ();
57
+ void testScaleLockCanvasResize ();
57
58
void testZoomByWheel ();
58
59
void testShiftZoom ();
59
60
@@ -300,6 +301,27 @@ void TestQgsMapCanvas::testMagnificationScale()
300
301
QCOMPARE ( initialScale, mCanvas ->scale () );
301
302
}
302
303
304
+ void TestQgsMapCanvas::testScaleLockCanvasResize ()
305
+ {
306
+ mCanvas ->resize ( 600 , 400 );
307
+ QCOMPARE ( mCanvas ->width (), 600 );
308
+ QCOMPARE ( mCanvas ->height (), 400 );
309
+
310
+ mCanvas ->setMagnificationFactor ( 2.0 );
311
+ double initialScale = mCanvas ->scale ();
312
+ mCanvas ->setScaleLocked ( true );
313
+
314
+ mCanvas ->resize ( 300 , 200 );
315
+ QCOMPARE ( mCanvas ->width (), 300 );
316
+ QCOMPARE ( mCanvas ->height (), 200 );
317
+
318
+ QCOMPARE ( mCanvas ->magnificationFactor (), 2.0 );
319
+ QCOMPARE ( mCanvas ->scale (), initialScale );
320
+
321
+ mCanvas ->setScaleLocked ( false );
322
+ mCanvas ->setMagnificationFactor ( 1.0 );
323
+ }
324
+
303
325
void TestQgsMapCanvas::testZoomByWheel ()
304
326
{
305
327
mCanvas ->setExtent ( QgsRectangle ( 0 , 0 , 10 , 10 ) );
0 commit comments