mirror of
https://github.com/qgis/QGIS.git
synced 2025-11-15 00:06:49 -05:00
Add SIP and Python unit test for overview autocentering.
Work funded by Tuscany Region - SITA. Contract "Support to the use of GFOSS (Geographic Free and Open Source Software) Desktop tools" (CIG Z3B06FA6D7).
This commit is contained in:
parent
9d20a69b94
commit
f0f72ca8a9
@ -300,7 +300,12 @@ class QgsComposerMap : QgsComposerItem
|
|||||||
/**Sets flag if overview frame should be inverted
|
/**Sets flag if overview frame should be inverted
|
||||||
@note this function was added in version 1.9*/
|
@note this function was added in version 1.9*/
|
||||||
void setOverviewInverted( bool inverted );
|
void setOverviewInverted( bool inverted );
|
||||||
bool overviewInverted() const;
|
bool overviewInverted() const;
|
||||||
|
|
||||||
|
/** Returns true if the extent is forced to center on the overview when the overview is outside the extent */
|
||||||
|
bool overviewCentered() const;
|
||||||
|
/** Set the overview's centering mode */
|
||||||
|
void setOverviewCentered( bool centered );
|
||||||
|
|
||||||
/**Sets mId to a number not yet used in the composition. mId is kept if it is not in use.
|
/**Sets mId to a number not yet used in the composition. mId is kept if it is not in use.
|
||||||
Usually, this function is called before adding the composer map to the composition*/
|
Usually, this function is called before adding the composer map to the composition*/
|
||||||
|
|||||||
@ -181,6 +181,32 @@ class TestQgsComposerMap(TestCase):
|
|||||||
self.mComposition.removeComposerItem(overviewMap)
|
self.mComposition.removeComposerItem(overviewMap)
|
||||||
assert myTestResult == True, myMessage
|
assert myTestResult == True, myMessage
|
||||||
|
|
||||||
|
def testOverviewMapCenter(self):
|
||||||
|
overviewMap = QgsComposerMap(self.mComposition, 20, 130, 70, 70)
|
||||||
|
overviewMap.setFrameEnabled(True)
|
||||||
|
self.mComposition.addComposerMap(overviewMap)
|
||||||
|
# zoom in
|
||||||
|
myRectangle = QgsRectangle(785462.375+5000, 3341423.125,
|
||||||
|
789262.375+5000, 3343323.125)
|
||||||
|
self.mComposerMap.setNewExtent(myRectangle)
|
||||||
|
myRectangle2 = QgsRectangle(781662.375, 3339523.125,
|
||||||
|
793062.375, 3350923.125)
|
||||||
|
overviewMap.setNewExtent(myRectangle2)
|
||||||
|
overviewMap.setOverviewFrameMap(self.mComposerMap.id())
|
||||||
|
overviewMap.setOverviewInverted(False)
|
||||||
|
overviewMap.setOverviewCentered(True)
|
||||||
|
checker = QgsCompositionChecker()
|
||||||
|
myPngPath = os.path.join(TEST_DATA_DIR,
|
||||||
|
'control_images',
|
||||||
|
'expected_composermap',
|
||||||
|
'composermap_landsat_overview_center.png')
|
||||||
|
myTestResult, myMessage = checker.testComposition(
|
||||||
|
'Composer map overview centered',
|
||||||
|
self.mComposition,
|
||||||
|
myPngPath)
|
||||||
|
self.mComposition.removeComposerItem(overviewMap)
|
||||||
|
assert myTestResult == True, myMessage
|
||||||
|
|
||||||
# Fails because addItemsFromXML has been commented out in sip
|
# Fails because addItemsFromXML has been commented out in sip
|
||||||
@expectedFailure
|
@expectedFailure
|
||||||
def testuniqueId(self):
|
def testuniqueId(self):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user