self.layer = None def test_label_line_avoid_jaggy(self): # Test that labeling a line using parallel labels won't place labels over jaggy bits of line self.layer = TestQgsPalLabeling.loadFeatureLayer('line_placement_5') self._TestMapSettings = self.cloneMapSettings(self._MapSettings) self.lyr.placement = QgsPalLayerSettings.Line self.checkTest() self.removeMapLayer(self.layer) self.layer = None def test_label_curved_zero_width_char(self): # Test that curved label work with zero-width characters self.layer = TestQgsPalLabeling.loadFeatureLayer('line') self._TestMapSettings = self.cloneMapSettings(self._MapSettings) self.lyr.placement = QgsPalLayerSettings.Curved self.lyr.placementFlags = QgsPalLayerSettings.OnLine self.lyr.fieldName = "'invisiblespace'" self.lyr.isExpression = True self.checkTest() self.removeMapLayer(self.layer) self.layer = None if __name__ == '__main__': # NOTE: unless PAL_SUITE env var is set all test class methods will be run # SEE: test_qgspallabeling_tests.suiteTests() to define suite suite = ('TestPointPlacement') res = runSuite(sys.modules[__name__], suite) sys.exit(not res.wasSuccessful())
def checkTest(self, **kwargs): self.lyr.writeToLayer(self.layer) self.saveControlImage() self.assertTrue(*self.renderCheck()) class TestCanvasBasePoint(TestCanvasBase): @classmethod def setUpClass(cls): TestCanvasBase.setUpClass() cls.layer = TestQgsPalLabeling.loadFeatureLayer('point') class TestCanvasPoint(TestCanvasBasePoint, TestPointBase): def setUp(self): """Run before each test.""" super(TestCanvasPoint, self).setUp() self.configTest('pal_canvas', 'sp') if __name__ == '__main__': # NOTE: unless PAL_SUITE env var is set all test class methods will be run # SEE: test_qgspallabeling_tests.suiteTests() to define suite suite = ( ['TestCanvasPoint.' + t for t in suiteTests()['sp_suite']] ) res = runSuite(sys.modules[__name__], suite) sys.exit(not res.wasSuccessful())
# class TestQgsPalLabelingLine(TestQgsPalLabeling): # """Layer-level property tests for line features""" # # @classmethod # def setUpClass(cls): # TestQgsPalLabeling.setUpClass() # cls.layer = TestQgsPalLabeling.loadFeatureLayer('line') # # def setUp(self): # """Run before each test.""" # self.configTest('pal_canvas', 'sl') # self.lyr = self.defaultSettings() # # def tearDown(self): # """Run after each test.""" # pass if __name__ == '__main__': # NOTE: unless PAL_SUITE env var is set # all test class methods will be run sp = 'TestQgsPalLabelingPoint.' sl = 'TestQgsPalLabelingLine.' sc = 'TestQgsPalLabelingCurved.' sg = 'TestQgsPalLabelingPolygon.' mf = 'TestQgsPalLabelingMultiFeature.' tests = [sp + 'test_default_label'] res = runSuite(sys.modules[__name__], tests) sys.exit(not res.wasSuccessful())