コード例 #1
0
    def setUp(self):
        """Create the server instance"""
        self.fontFamily = QgsFontUtils.standardTestFontFamily()
        QgsFontUtils.loadStandardTestFonts(['All'])

        d = unitTestDataPath('qgis_server_accesscontrol') + '/'
        self._project_path = os.path.join(d, "project.qgs")
コード例 #2
0
def loadTestFonts():
    start_app()

    global FONTSLOADED  # pylint: disable=W0603
    if FONTSLOADED is False:
        QgsFontUtils.loadStandardTestFonts(['Roman', 'Bold'])
        msg = getTestFontFamily() + ' base test font styles could not be loaded'
        res = (QgsFontUtils.fontFamilyHasStyle(getTestFontFamily(), 'Roman')
               and QgsFontUtils.fontFamilyHasStyle(getTestFontFamily(), 'Bold'))
        assert res, msg
        FONTSLOADED = True
コード例 #3
0
ファイル: utilities.py プロジェクト: ndavid/QGIS
def loadTestFonts():
    start_app()

    global FONTSLOADED  # pylint: disable=W0603
    if FONTSLOADED is False:
        QgsFontUtils.loadStandardTestFonts(["Roman", "Bold"])
        msg = getTestFontFamily() + " base test font styles could not be loaded"
        res = QgsFontUtils.fontFamilyHasStyle(getTestFontFamily(), "Roman") and QgsFontUtils.fontFamilyHasStyle(
            getTestFontFamily(), "Bold"
        )
        assert res, msg
        FONTSLOADED = True
コード例 #4
0
ファイル: test_qgsfontutils.py プロジェクト: cz172638/QGIS
    def test_loading_every_test_font(self):
        QgsFontUtils.loadStandardTestFonts(['All'])
        # styles = ''
        # for style in QFontDatabase().styles(self._family):
        #     styles += ' ' + style
        # print self._family + ' styles:' + styles

        res = (
            self._has_style(self._family, 'Roman') and
            self._has_style(self._family, 'Oblique') and
            self._has_style(self._family, 'Bold') and
            self._has_style(self._family, 'Bold Oblique')
        )
        msg = self._family + ' test font styles could not be loaded'
        assert res, msg
コード例 #5
0
ファイル: test_qgsserver.py プロジェクト: cz172638/QGIS
    def setUp(self):
        """Create the server instance"""
        self.fontFamily = QgsFontUtils.standardTestFontFamily()
        QgsFontUtils.loadStandardTestFonts(['All'])

        self.testdata_path = unitTestDataPath('qgis_server') + '/'

        d = unitTestDataPath('qgis_server_accesscontrol') + '/'
        self.projectPath = os.path.join(d, "project.qgs")
        self.projectAnnotationPath = os.path.join(d, "project_with_annotations.qgs")
        self.projectStatePath = os.path.join(d, "project_state.qgs")
        self.projectUseLayerIdsPath = os.path.join(d, "project_use_layerids.qgs")

        # Clean env just to be sure
        env_vars = ['QUERY_STRING', 'QGIS_PROJECT_FILE']
        for ev in env_vars:
            try:
                del os.environ[ev]
            except KeyError:
                pass
        self.server = QgsServer()
コード例 #6
0
    def setUp(self):
        """Create the server instance"""
        self.fontFamily = QgsFontUtils.standardTestFontFamily()
        QgsFontUtils.loadStandardTestFonts(['All'])

        self.testdata_path = unitTestDataPath('qgis_server') + '/'

        d = unitTestDataPath('qgis_server') + '/'
        self.projectPath = os.path.join(d, "project.qgs")

        # Clean env just to be sure
        env_vars = ['QUERY_STRING', 'QGIS_PROJECT_FILE']
        for ev in env_vars:
            try:
                del os.environ[ev]
            except KeyError:
                pass

        os.environ['QGIS_SERVER_OVERRIDE_SYSTEM_LOCALE'] = 'EN_us'
        os.environ['QGIS_SERVER_SHOW_GROUP_SEPARATOR'] = '0'

        self.server = QgsServer()
コード例 #7
0
    def setUp(self):
        """Create the server instance"""
        self.fontFamily = QgsFontUtils.standardTestFontFamily()
        QgsFontUtils.loadStandardTestFonts(['All'])

        self.testdata_path = unitTestDataPath('qgis_server') + '/'

        d = unitTestDataPath('qgis_server_accesscontrol') + '/'
        self.projectPath = os.path.join(d, "project.qgs")
        self.projectAnnotationPath = os.path.join(d, "project_with_annotations.qgs")
        self.projectStatePath = os.path.join(d, "project_state.qgs")
        self.projectUseLayerIdsPath = os.path.join(d, "project_use_layerids.qgs")
        self.projectGroupsPath = os.path.join(d, "project_groups.qgs")

        # Clean env just to be sure
        env_vars = ['QUERY_STRING', 'QGIS_PROJECT_FILE']
        for ev in env_vars:
            try:
                del os.environ[ev]
            except KeyError:
                pass
        self.server = QgsServer()
コード例 #8
0
    def setUp(self):
        """Create the server instance"""
        self.fontFamily = QgsFontUtils.standardTestFontFamily()
        QgsFontUtils.loadStandardTestFonts(['All'])

        self.testdata_path = unitTestDataPath('qgis_server') + '/'

        d = unitTestDataPath('qgis_server') + '/'
        self.projectPath = os.path.join(d, "project.qgs")

        # Clean env just to be sure
        env_vars = ['QUERY_STRING', 'QGIS_PROJECT_FILE']
        for ev in env_vars:
            try:
                del os.environ[ev]
            except KeyError:
                pass

        os.environ['QGIS_SERVER_OVERRIDE_SYSTEM_LOCALE'] = 'EN_us'
        os.environ['QGIS_SERVER_SHOW_GROUP_SEPARATOR'] = '0'

        self.server = QgsServer()
コード例 #9
0
ファイル: test_qgsserver.py プロジェクト: rldhont/QGIS
    def setUpClass(self):
        """Create the server instance"""
        self.fontFamily = QgsFontUtils.standardTestFontFamily()
        QgsFontUtils.loadStandardTestFonts(['All'])

        self.temporary_dir = tempfile.TemporaryDirectory()
        self.temporary_path = self.temporary_dir.name

        # Copy all testdata to the temporary directory
        copytree(unitTestDataPath('qgis_server'),
                 os.path.join(self.temporary_path, 'qgis_server'))
        copytree(
            unitTestDataPath('qgis_server_accesscontrol'),
            os.path.join(self.temporary_path, 'qgis_server_accesscontrol'))

        for f in [
                'empty_spatial_layer.dbf',
                'empty_spatial_layer.prj',
                'empty_spatial_layer.qpj',
                'empty_spatial_layer.shp',
                'empty_spatial_layer.shx',
                'france_parts.dbf',
                'france_parts.prj',
                'france_parts.qpj',
                'france_parts.shp',
                'france_parts.shp.xml',
                'france_parts.shx',
                'landsat.tif',
                'points.dbf',
                'points.prj',
                'points.shp',
                'points.shx',
                'requires_warped_vrt.tif',
        ]:
            os.symlink(unitTestDataPath(f),
                       os.path.join(self.temporary_path, f))

        self.testdata_path = os.path.join(self.temporary_path,
                                          'qgis_server') + '/'

        d = os.path.join(self.temporary_path, 'qgis_server_accesscontrol')

        self.projectPath = os.path.join(d, "project.qgs")
        self.projectAnnotationPath = os.path.join(
            d, "project_with_annotations.qgs")
        self.projectStatePath = os.path.join(d, "project_state.qgs")
        self.projectUseLayerIdsPath = os.path.join(d,
                                                   "project_use_layerids.qgs")
        self.projectGroupsPath = os.path.join(d, "project_groups.qgs")

        # Clean env just to be sure
        env_vars = ['QUERY_STRING', 'QGIS_PROJECT_FILE']
        for ev in env_vars:
            try:
                del os.environ[ev]
            except KeyError:
                pass

        self.server = QgsServer()

        # Disable landing page API to test standard legacy XML responses in case of errors
        os.environ["QGIS_SERVER_DISABLED_APIS"] = "Landing Page"
コード例 #10
0
 def setUp(self):
     self.report = "<h1>Python QgsTextRenderer Tests</h1>\n"
     QgsFontUtils.loadStandardTestFonts(['Bold', 'Oblique'])