Beispiel #1
0
    def test_runTsunamiBuildingImpactFunction(self):
        """Tsunami function runs in GUI as expected."""

        # Push OK with the left mouse button

        myButton = DOCK.pbnRunStop

        myMessage = 'Run button was not enabled'
        assert myButton.isEnabled(), myMessage

        # Hazard layers
        myIndex = DOCK.cboHazard.findText('Tsunami Max Inundation')
        assert myIndex != -1, 'Tsunami Max Inundation hazard layer not found'
        DOCK.cboHazard.setCurrentIndex(myIndex)

        # Exposure layers
        myIndex = DOCK.cboExposure.findText('Tsunami Building Exposure')
        assert myIndex != -1, 'Tsunami Building Exposure layer not found'
        DOCK.cboExposure.setCurrentIndex(myIndex)

        # Check that layers and impact function are correct
        myDict = getUiState(DOCK)

        myExpectedDict = {'Run Button Enabled': True,
                          'Impact Function Id':
                              'Flood Building Impact Function',
                          'Impact Function Title':
                              'Be temporarily closed',
                          'Hazard': 'Tsunami Max Inundation',
                          'Exposure': 'Tsunami Building Exposure'}
        myMessage = 'Got unexpected state: %s\nExpected: %s\n%s' % (
            myDict, myExpectedDict, combosToString(DOCK))
        assert myDict == myExpectedDict, myMessage

        setCanvasCrs(GEOCRS, True)
        setBatemansBayGeoExtent()

        # Press RUN
        QTest.mouseClick(myButton, QtCore.Qt.LeftButton)
        myResult = DOCK.wvResults.page().currentFrame().toPlainText()

        #print myResult
        # Post clip on steroids refactor
        # < 1 m:    1923
        # 1 - 3 m:    89
        # > 3 m:    0
        # Post replacement of Batemans Bay dataset
        #< 1 m:  10
        #1 - 3 m:    7
        #> 3 m:  0
        # Post rewrite of impact function
        #Building type	Temporarily closed	Total
        #All	        7	                17

        myMessage = 'Result not as expected: %s' % myResult
        assert '17' in myResult, myMessage
        assert '7' in myResult, myMessage
Beispiel #2
0
    def test_runTsunamiBuildingImpactFunction(self):
        """Tsunami function runs in GUI as expected."""

        # Push OK with the left mouse button

        myButton = DOCK.pbnRunStop

        myMessage = 'Run button was not enabled'
        assert myButton.isEnabled(), myMessage

        # Hazard layers
        myIndex = DOCK.cboHazard.findText('Tsunami Max Inundation')
        assert myIndex != -1, 'Tsunami Max Inundation hazard layer not found'
        DOCK.cboHazard.setCurrentIndex(myIndex)

        # Exposure layers
        myIndex = DOCK.cboExposure.findText('Tsunami Building Exposure')
        assert myIndex != -1, 'Tsunami Building Exposure layer not found'
        DOCK.cboExposure.setCurrentIndex(myIndex)

        # Check that layers and impact function are correct
        myDict = getUiState(DOCK)

        myExpectedDict = {
            'Run Button Enabled': True,
            'Impact Function Id': 'Flood Building Impact Function',
            'Impact Function Title': 'Be temporarily closed',
            'Hazard': 'Tsunami Max Inundation',
            'Exposure': 'Tsunami Building Exposure'
        }
        myMessage = 'Got unexpected state: %s\nExpected: %s\n%s' % (
            myDict, myExpectedDict, combosToString(DOCK))
        assert myDict == myExpectedDict, myMessage

        setCanvasCrs(GEOCRS, True)
        setBatemansBayGeoExtent()

        # Press RUN
        QTest.mouseClick(myButton, QtCore.Qt.LeftButton)
        myResult = DOCK.wvResults.page().currentFrame().toPlainText()

        #print myResult
        # Post clip on steroids refactor
        # < 1 m:    1923
        # 1 - 3 m:    89
        # > 3 m:    0
        # Post replacement of Batemans Bay dataset
        #< 1 m:  10
        #1 - 3 m:    7
        #> 3 m:  0
        # Post rewrite of impact function
        #Building type	Temporarily closed	Total
        #All	        7	                17

        myMessage = 'Result not as expected: %s' % myResult
        assert '17' in myResult, myMessage
        assert '7' in myResult, myMessage