mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-06 00:07:29 -04:00
Add tests for atlas legend clipping
This commit is contained in:
parent
d156fbabfc
commit
bbfefcfc81
@ -49,7 +49,8 @@ from qgis.core import (
|
||||
QgsSymbol,
|
||||
QgsVectorLayer,
|
||||
QgsReadWriteContext,
|
||||
QgsTextFormat
|
||||
QgsTextFormat,
|
||||
QgsFeatureRequest,
|
||||
)
|
||||
import unittest
|
||||
from qgis.testing import start_app, QgisTestCase
|
||||
@ -1131,6 +1132,36 @@ class TestQgsLayoutItemLegend(QgisTestCase, LayoutItemTestCase):
|
||||
)
|
||||
)
|
||||
|
||||
def test_atlas_legend_clipping(self):
|
||||
"""Test issue GH #54654"""
|
||||
|
||||
p = QgsProject()
|
||||
self.assertTrue(p.read(os.path.join(TEST_DATA_DIR, 'layouts', 'atlas_legend_clipping.qgs')))
|
||||
|
||||
layout = p.layoutManager().layoutByName('layout1')
|
||||
|
||||
layer = list(p.mapLayers().values())[0]
|
||||
feature = layer.getFeature(3)
|
||||
req = QgsFeatureRequest()
|
||||
req.setFilterExpression('value = 11')
|
||||
feature = next(layer.getFeatures(req))
|
||||
|
||||
layout.reportContext().setFeature(feature)
|
||||
legend = layout.items()[0]
|
||||
legend.setStyleFont(QgsLegendStyle.Title, QgsFontUtils.getStandardTestFont('Bold', 20))
|
||||
legend.setStyleFont(QgsLegendStyle.Group, QgsFontUtils.getStandardTestFont('Bold', 20))
|
||||
legend.setStyleFont(QgsLegendStyle.Subgroup, QgsFontUtils.getStandardTestFont('Bold', 20))
|
||||
legend.setStyleFont(QgsLegendStyle.Symbol, QgsFontUtils.getStandardTestFont('Bold', 20))
|
||||
legend.setStyleFont(QgsLegendStyle.SymbolLabel,
|
||||
QgsFontUtils.getStandardTestFont('Bold', 20))
|
||||
legend.refresh()
|
||||
|
||||
self.assertTrue(
|
||||
self.render_layout_check(
|
||||
'atlas_legend_clipping', layout
|
||||
)
|
||||
)
|
||||
|
||||
def test_filter_by_map_content_rendering_different_layers_in_atlas(self):
|
||||
point_path = os.path.join(TEST_DATA_DIR, 'points.shp')
|
||||
point_layer = QgsVectorLayer(point_path, 'points', 'ogr')
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
1428
tests/testdata/layouts/atlas_legend_clipping.qgs
vendored
Normal file
1428
tests/testdata/layouts/atlas_legend_clipping.qgs
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user