Exemplo n.º 1
0
    def test_wmts_config(self):
        projectPath = self.projectGroupsPath
        assert os.path.exists(
            projectPath), "Project file not found: " + projectPath

        project = QgsProject()
        project.read(projectPath)
        self.wmts_request_compare_project(
            project,
            'GetCapabilities',
            reference_base_name='wmts_getcapabilities_config')

        self.assertTrue(project.removeEntry('WMTSGrids', 'Config'))
        self.assertTrue(project.removeEntry('WMTSGrids', 'CRS'))
        self.wmts_request_compare_project(
            project,
            'GetCapabilities',
            reference_base_name='wmts_getcapabilities_config')

        self.assertTrue(
            project.writeEntry('WMTSGrids', 'Config', (
                'EPSG:3857,20037508.342789248,-20037508.342789248,559082264.0287179,20',
            )))
        self.assertTrue(project.writeEntry('WMTSGrids', 'CRS',
                                           ('EPSG:3857', )))
        self.wmts_request_compare_project(
            project,
            'GetCapabilities',
            reference_base_name='wmts_getcapabilities_config_3857')
Exemplo n.º 2
0
    def test_wmts_config(self):
        projectPath = self.projectGroupsPath
        assert os.path.exists(projectPath), "Project file not found: " + projectPath

        project = QgsProject()
        project.read(projectPath)
        self.wmts_request_compare_project(project, 'GetCapabilities', reference_base_name='wmts_getcapabilities_config')

        self.assertTrue(project.removeEntry('WMTSGrids', 'Config'))
        self.assertTrue(project.removeEntry('WMTSGrids', 'CRS'))
        self.wmts_request_compare_project(project, 'GetCapabilities', reference_base_name='wmts_getcapabilities_config')

        self.assertTrue(project.writeEntry('WMTSGrids', 'Config', ('EPSG:3857,20037508.342789248,-20037508.342789248,559082264.0287179,20',)))
        self.assertTrue(project.writeEntry('WMTSGrids', 'CRS', ('EPSG:3857',)))
        self.wmts_request_compare_project(project, 'GetCapabilities', reference_base_name='wmts_getcapabilities_config_3857')
Exemplo n.º 3
0
    def testDirtying(self):

        project = QgsProject()

        # writing a new entry should dirty the project
        project.setDirty(False)
        self.assertTrue(project.writeEntry('myscope', 'myentry', True))
        self.assertTrue(project.isDirty())

        # over-writing a pre-existing entry with the same value should _not_ dirty the project
        project.setDirty(False)
        self.assertTrue(project.writeEntry('myscope', 'myentry', True))
        self.assertFalse(project.isDirty())

        # over-writing a pre-existing entry with a different value should dirty the project
        project.setDirty(False)
        self.assertTrue(project.writeEntry('myscope', 'myentry', False))
        self.assertTrue(project.isDirty())

        # removing an existing entry should dirty the project
        project.setDirty(False)
        self.assertTrue(project.removeEntry('myscope', 'myentry'))
        self.assertTrue(project.isDirty())

        # removing a non-existing entry should _not_ dirty the project
        project.setDirty(False)
        self.assertTrue(project.removeEntry('myscope', 'myentry'))
        self.assertFalse(project.isDirty())

        # setting a project CRS with a new value should dirty the project
        project.setCrs(QgsCoordinateReferenceSystem('EPSG:4326'))
        project.setDirty(False)
        project.setCrs(QgsCoordinateReferenceSystem('EPSG:3148'))
        self.assertTrue(project.isDirty())

        # setting a project CRS with the same project CRS should not dirty the project
        project.setDirty(False)
        project.setCrs(QgsCoordinateReferenceSystem('EPSG:3148'))
        self.assertFalse(project.isDirty())
Exemplo n.º 4
0
    def testDirtying(self):

        project = QgsProject()

        # writing a new entry should dirty the project
        project.setDirty(False)
        self.assertTrue(project.writeEntry('myscope', 'myentry', True))
        self.assertTrue(project.isDirty())

        # over-writing a pre-existing entry with the same value should _not_ dirty the project
        project.setDirty(False)
        self.assertTrue(project.writeEntry('myscope', 'myentry', True))
        self.assertFalse(project.isDirty())

        # over-writing a pre-existing entry with a different value should dirty the project
        project.setDirty(False)
        self.assertTrue(project.writeEntry('myscope', 'myentry', False))
        self.assertTrue(project.isDirty())

        # removing an existing entry should dirty the project
        project.setDirty(False)
        self.assertTrue(project.removeEntry('myscope', 'myentry'))
        self.assertTrue(project.isDirty())

        # removing a non-existing entry should _not_ dirty the project
        project.setDirty(False)
        self.assertTrue(project.removeEntry('myscope', 'myentry'))
        self.assertFalse(project.isDirty())

        # setting a project CRS with a new value should dirty the project
        project.setCrs(QgsCoordinateReferenceSystem('EPSG:4326'))
        project.setDirty(False)
        project.setCrs(QgsCoordinateReferenceSystem('EPSG:3148'))
        self.assertTrue(project.isDirty())

        # setting a project CRS with the same project CRS should not dirty the project
        project.setDirty(False)
        project.setCrs(QgsCoordinateReferenceSystem('EPSG:3148'))
        self.assertFalse(project.isDirty())