Skip to content

Commit 16cab9f

Browse files
committedJun 24, 2015
Add tests for line placement of labels
1 parent d4b659e commit 16cab9f

File tree

52 files changed

+514
-3
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+514
-3
lines changed
 

‎tests/src/python/test_qgspallabeling_canvas.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
from test_qgspallabeling_base import TestQgsPalLabeling, runSuite
3232
from test_qgspallabeling_tests import (
3333
TestPointBase,
34+
TestLineBase,
3435
suiteTests
3536
)
3637

@@ -114,6 +115,20 @@ def setUp(self):
114115
super(TestCanvasPoint, self).setUp()
115116
self.configTest('pal_canvas', 'sp')
116117

118+
class TestCanvasBaseLine(TestCanvasBase):
119+
120+
@classmethod
121+
def setUpClass(cls):
122+
TestCanvasBase.setUpClass()
123+
cls.layer = TestQgsPalLabeling.loadFeatureLayer('line')
124+
125+
class TestCanvasLine(TestCanvasBaseLine, TestLineBase):
126+
127+
def setUp(self):
128+
"""Run before each test."""
129+
super(TestCanvasLine, self).setUp()
130+
self.configTest('pal_canvas_line', 'sp')
131+
117132

118133
if __name__ == '__main__':
119134
# NOTE: unless PAL_SUITE env var is set all test class methods will be run

‎tests/src/python/test_qgspallabeling_composer.py

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
from test_qgspallabeling_base import TestQgsPalLabeling, runSuite
3838
from test_qgspallabeling_tests import (
3939
TestPointBase,
40+
TestLineBase,
4041
suiteTests
4142
)
4243

@@ -375,6 +376,74 @@ def setUp(self):
375376
self._Mismatch = 50
376377
self._ColorTol = 18
377378

379+
class TestComposerLineBase(TestComposerBase):
380+
381+
@classmethod
382+
def setUpClass(cls):
383+
TestComposerBase.setUpClass()
384+
cls.layer = TestQgsPalLabeling.loadFeatureLayer('line')
385+
386+
387+
class TestComposerImageLine(TestComposerLineBase, TestLineBase):
388+
389+
def setUp(self):
390+
"""Run before each test."""
391+
super(TestComposerImageLine, self).setUp()
392+
self._TestKind = OutputKind.Img
393+
self.configTest('pal_composer_line', 'sp_img')
394+
395+
396+
class TestComposerImageVsCanvasLine(TestComposerLineBase, TestLineBase):
397+
398+
def setUp(self):
399+
"""Run before each test."""
400+
super(TestComposerImageVsCanvasLine, self).setUp()
401+
self._TestKind = OutputKind.Img
402+
self.configTest('pal_canvas_line', 'sp')
403+
404+
405+
class TestComposerSvgLine(TestComposerLineBase, TestLineBase):
406+
407+
def setUp(self):
408+
"""Run before each test."""
409+
super(TestComposerSvgLine, self).setUp()
410+
self._TestKind = OutputKind.Svg
411+
self.configTest('pal_composer_line', 'sp_svg')
412+
413+
414+
class TestComposerSvgVsComposerLine(TestComposerLineBase, TestLineBase):
415+
"""
416+
Compare only to composer image, which is already compared to canvas line
417+
"""
418+
def setUp(self):
419+
"""Run before each test."""
420+
super(TestComposerSvgVsComposerLine, self).setUp()
421+
self._TestKind = OutputKind.Svg
422+
self.configTest('pal_composer_line', 'sp_img')
423+
self._ColorTol = 4
424+
425+
426+
class TestComposerPdfLine(TestComposerLineBase, TestLineBase):
427+
428+
def setUp(self):
429+
"""Run before each test."""
430+
super(TestComposerPdfLine, self).setUp()
431+
self._TestKind = OutputKind.Pdf
432+
self.configTest('pal_composer_line', 'sp_pdf')
433+
434+
435+
class TestComposerPdfVsComposerLine(TestComposerLineBase, TestLineBase):
436+
"""
437+
Compare only to composer image, which is already compared to canvas line
438+
"""
439+
def setUp(self):
440+
"""Run before each test."""
441+
super(TestComposerPdfVsComposerLine, self).setUp()
442+
self._TestKind = OutputKind.Pdf
443+
self.configTest('pal_composer_line', 'sp_img')
444+
self._Mismatch = 50
445+
self._ColorTol = 18
446+
378447

379448
if __name__ == '__main__':
380449
# NOTE: unless PAL_SUITE env var is set all test class methods will be run

0 commit comments

Comments
 (0)
Please sign in to comment.