Skip to content

Commit b8d2a17

Browse files
committed
Port symbols test from ebf20a5
1 parent 4c52607 commit b8d2a17

File tree

2 files changed

+309
-0
lines changed

2 files changed

+309
-0
lines changed

tests/src/core/testqgsinvertedpolygonrenderer.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
#include <qgsapplication.h>
2828
#include <qgsproviderregistry.h>
2929
#include <qgsproject.h>
30+
#include "qgsrenderer.h"
31+
3032
//qgis test includes
3133
#include "qgsmultirenderchecker.h"
3234

@@ -48,6 +50,7 @@ class TestQgsInvertedPolygon : public QObject
4850

4951
void singleSubRenderer();
5052
void graduatedSubRenderer();
53+
void checkSymbolItem();
5154
void preprocess();
5255
void projectionTest();
5356
#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_MAJOR >= 2
@@ -128,6 +131,15 @@ void TestQgsInvertedPolygon::graduatedSubRenderer()
128131
QVERIFY( imageCheck( "inverted_polys_graduated" ) );
129132
}
130133

134+
void TestQgsInvertedPolygon::checkSymbolItem()
135+
{
136+
QVERIFY( setQml( mpPolysLayer, "inverted_polys_rule.qml" ) );
137+
QString firstRuleKey = mpPolysLayer->renderer()->legendSymbolItems().first().ruleKey();
138+
QVERIFY( mpPolysLayer->renderer()->legendSymbolItemChecked( firstRuleKey ) );
139+
mpPolysLayer->renderer()->checkLegendSymbolItem( firstRuleKey, false );
140+
QVERIFY( !mpPolysLayer->renderer()->legendSymbolItemChecked( firstRuleKey ) );
141+
}
142+
131143
void TestQgsInvertedPolygon::preprocess()
132144
{
133145
// FIXME will have to find some overlapping polygons
+297
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,297 @@
1+
<!DOCTYPE qgis PUBLIC 'http://mrcc.com/qgis.dtd' 'SYSTEM'>
2+
<qgis version="2.18.9" simplifyAlgorithm="0" minimumScale="0" maximumScale="1e+08" simplifyDrawingHints="1" minLabelScale="0" maxLabelScale="1e+08" simplifyDrawingTol="1" readOnly="0" simplifyMaxScale="1" hasScaleBasedVisibilityFlag="0" simplifyLocal="1" scaleBasedLabelVisibilityFlag="0">
3+
<edittypes>
4+
<edittype widgetv2type="TextEdit" name="Name">
5+
<widgetv2config IsMultiline="0" fieldEditable="1" constraint="" UseHtml="0" labelOnTop="0" constraintDescription="" notNull="0"/>
6+
</edittype>
7+
<edittype widgetv2type="TextEdit" name="Value">
8+
<widgetv2config IsMultiline="0" fieldEditable="1" constraint="" UseHtml="0" labelOnTop="0" constraintDescription="" notNull="0"/>
9+
</edittype>
10+
</edittypes>
11+
<renderer-v2 forceraster="0" preprocessing="0" type="invertedPolygonRenderer" enableorderby="0">
12+
<renderer-v2 forceraster="0" symbollevels="0" type="RuleRenderer" enableorderby="0">
13+
<rules key="{7c47ddbb-77ed-4795-a788-47dfd5a912e4}">
14+
<rule filter="Value = 7" key="{579517cb-b8c8-49a1-8580-00241734f728}" symbol="0" label="Seven"/>
15+
<rule filter="Value = 10" key="{937affbb-2809-4f1a-868b-d5fa8e995494}" symbol="1" label="Ten"/>
16+
</rules>
17+
<symbols>
18+
<symbol alpha="1" clip_to_extent="1" type="fill" name="0">
19+
<layer pass="0" class="SimpleFill" locked="0">
20+
<prop k="border_width_map_unit_scale" v="0,0,0,0,0,0"/>
21+
<prop k="color" v="163,163,163,255"/>
22+
<prop k="joinstyle" v="bevel"/>
23+
<prop k="offset" v="0,0"/>
24+
<prop k="offset_map_unit_scale" v="0,0,0,0,0,0"/>
25+
<prop k="offset_unit" v="MM"/>
26+
<prop k="outline_color" v="163,163,163,255"/>
27+
<prop k="outline_style" v="solid"/>
28+
<prop k="outline_width" v="0.26"/>
29+
<prop k="outline_width_unit" v="MM"/>
30+
<prop k="style" v="solid"/>
31+
</layer>
32+
</symbol>
33+
<symbol alpha="1" clip_to_extent="1" type="fill" name="1">
34+
<layer pass="0" class="SimpleFill" locked="0">
35+
<prop k="border_width_map_unit_scale" v="0,0,0,0,0,0"/>
36+
<prop k="color" v="255,255,255,255"/>
37+
<prop k="joinstyle" v="bevel"/>
38+
<prop k="offset" v="0,0"/>
39+
<prop k="offset_map_unit_scale" v="0,0,0,0,0,0"/>
40+
<prop k="offset_unit" v="MM"/>
41+
<prop k="outline_color" v="255,255,255,255"/>
42+
<prop k="outline_style" v="solid"/>
43+
<prop k="outline_width" v="0.26"/>
44+
<prop k="outline_width_unit" v="MM"/>
45+
<prop k="style" v="solid"/>
46+
</layer>
47+
</symbol>
48+
</symbols>
49+
</renderer-v2>
50+
</renderer-v2>
51+
<labeling type="simple"/>
52+
<customproperties>
53+
<property key="embeddedWidgets/count" value="0"/>
54+
<property key="labeling" value="pal"/>
55+
<property key="labeling/addDirectionSymbol" value="false"/>
56+
<property key="labeling/angleOffset" value="0"/>
57+
<property key="labeling/blendMode" value="0"/>
58+
<property key="labeling/bufferBlendMode" value="0"/>
59+
<property key="labeling/bufferColorA" value="255"/>
60+
<property key="labeling/bufferColorB" value="255"/>
61+
<property key="labeling/bufferColorG" value="255"/>
62+
<property key="labeling/bufferColorR" value="255"/>
63+
<property key="labeling/bufferDraw" value="false"/>
64+
<property key="labeling/bufferJoinStyle" value="128"/>
65+
<property key="labeling/bufferNoFill" value="false"/>
66+
<property key="labeling/bufferSize" value="1"/>
67+
<property key="labeling/bufferSizeInMapUnits" value="false"/>
68+
<property key="labeling/bufferSizeMapUnitScale" value="0,0,0,0,0,0"/>
69+
<property key="labeling/bufferTransp" value="0"/>
70+
<property key="labeling/centroidInside" value="false"/>
71+
<property key="labeling/centroidWhole" value="false"/>
72+
<property key="labeling/decimals" value="3"/>
73+
<property key="labeling/displayAll" value="false"/>
74+
<property key="labeling/dist" value="0"/>
75+
<property key="labeling/distInMapUnits" value="false"/>
76+
<property key="labeling/distMapUnitScale" value="0,0,0,0,0,0"/>
77+
<property key="labeling/drawLabels" value="false"/>
78+
<property key="labeling/enabled" value="false"/>
79+
<property key="labeling/fieldName" value=""/>
80+
<property key="labeling/fitInPolygonOnly" value="false"/>
81+
<property key="labeling/fontCapitals" value="0"/>
82+
<property key="labeling/fontFamily" value="Cantarell"/>
83+
<property key="labeling/fontItalic" value="false"/>
84+
<property key="labeling/fontLetterSpacing" value="0"/>
85+
<property key="labeling/fontLimitPixelSize" value="false"/>
86+
<property key="labeling/fontMaxPixelSize" value="10000"/>
87+
<property key="labeling/fontMinPixelSize" value="3"/>
88+
<property key="labeling/fontSize" value="11"/>
89+
<property key="labeling/fontSizeInMapUnits" value="false"/>
90+
<property key="labeling/fontSizeMapUnitScale" value="0,0,0,0,0,0"/>
91+
<property key="labeling/fontStrikeout" value="false"/>
92+
<property key="labeling/fontUnderline" value="false"/>
93+
<property key="labeling/fontWeight" value="50"/>
94+
<property key="labeling/fontWordSpacing" value="0"/>
95+
<property key="labeling/formatNumbers" value="false"/>
96+
<property key="labeling/isExpression" value="true"/>
97+
<property key="labeling/labelOffsetInMapUnits" value="true"/>
98+
<property key="labeling/labelOffsetMapUnitScale" value="0,0,0,0,0,0"/>
99+
<property key="labeling/labelPerPart" value="false"/>
100+
<property key="labeling/leftDirectionSymbol" value="&lt;"/>
101+
<property key="labeling/limitNumLabels" value="false"/>
102+
<property key="labeling/maxCurvedCharAngleIn" value="25"/>
103+
<property key="labeling/maxCurvedCharAngleOut" value="-25"/>
104+
<property key="labeling/maxNumLabels" value="2000"/>
105+
<property key="labeling/mergeLines" value="false"/>
106+
<property key="labeling/minFeatureSize" value="0"/>
107+
<property key="labeling/multilineAlign" value="4294967295"/>
108+
<property key="labeling/multilineHeight" value="1"/>
109+
<property key="labeling/namedStyle" value="Regular"/>
110+
<property key="labeling/obstacle" value="true"/>
111+
<property key="labeling/obstacleFactor" value="1"/>
112+
<property key="labeling/obstacleType" value="0"/>
113+
<property key="labeling/offsetType" value="0"/>
114+
<property key="labeling/placeDirectionSymbol" value="0"/>
115+
<property key="labeling/placement" value="1"/>
116+
<property key="labeling/placementFlags" value="10"/>
117+
<property key="labeling/plussign" value="false"/>
118+
<property key="labeling/predefinedPositionOrder" value="TR,TL,BR,BL,R,L,TSR,BSR"/>
119+
<property key="labeling/preserveRotation" value="true"/>
120+
<property key="labeling/previewBkgrdColor" value="#ffffff"/>
121+
<property key="labeling/priority" value="5"/>
122+
<property key="labeling/quadOffset" value="4"/>
123+
<property key="labeling/repeatDistance" value="0"/>
124+
<property key="labeling/repeatDistanceMapUnitScale" value="0,0,0,0,0,0"/>
125+
<property key="labeling/repeatDistanceUnit" value="1"/>
126+
<property key="labeling/reverseDirectionSymbol" value="false"/>
127+
<property key="labeling/rightDirectionSymbol" value=">"/>
128+
<property key="labeling/scaleMax" value="10000000"/>
129+
<property key="labeling/scaleMin" value="1"/>
130+
<property key="labeling/scaleVisibility" value="false"/>
131+
<property key="labeling/shadowBlendMode" value="6"/>
132+
<property key="labeling/shadowColorB" value="0"/>
133+
<property key="labeling/shadowColorG" value="0"/>
134+
<property key="labeling/shadowColorR" value="0"/>
135+
<property key="labeling/shadowDraw" value="false"/>
136+
<property key="labeling/shadowOffsetAngle" value="135"/>
137+
<property key="labeling/shadowOffsetDist" value="1"/>
138+
<property key="labeling/shadowOffsetGlobal" value="true"/>
139+
<property key="labeling/shadowOffsetMapUnitScale" value="0,0,0,0,0,0"/>
140+
<property key="labeling/shadowOffsetUnits" value="1"/>
141+
<property key="labeling/shadowRadius" value="1.5"/>
142+
<property key="labeling/shadowRadiusAlphaOnly" value="false"/>
143+
<property key="labeling/shadowRadiusMapUnitScale" value="0,0,0,0,0,0"/>
144+
<property key="labeling/shadowRadiusUnits" value="1"/>
145+
<property key="labeling/shadowScale" value="100"/>
146+
<property key="labeling/shadowTransparency" value="30"/>
147+
<property key="labeling/shadowUnder" value="0"/>
148+
<property key="labeling/shapeBlendMode" value="0"/>
149+
<property key="labeling/shapeBorderColorA" value="255"/>
150+
<property key="labeling/shapeBorderColorB" value="128"/>
151+
<property key="labeling/shapeBorderColorG" value="128"/>
152+
<property key="labeling/shapeBorderColorR" value="128"/>
153+
<property key="labeling/shapeBorderWidth" value="0"/>
154+
<property key="labeling/shapeBorderWidthMapUnitScale" value="0,0,0,0,0,0"/>
155+
<property key="labeling/shapeBorderWidthUnits" value="1"/>
156+
<property key="labeling/shapeDraw" value="false"/>
157+
<property key="labeling/shapeFillColorA" value="255"/>
158+
<property key="labeling/shapeFillColorB" value="255"/>
159+
<property key="labeling/shapeFillColorG" value="255"/>
160+
<property key="labeling/shapeFillColorR" value="255"/>
161+
<property key="labeling/shapeJoinStyle" value="64"/>
162+
<property key="labeling/shapeOffsetMapUnitScale" value="0,0,0,0,0,0"/>
163+
<property key="labeling/shapeOffsetUnits" value="1"/>
164+
<property key="labeling/shapeOffsetX" value="0"/>
165+
<property key="labeling/shapeOffsetY" value="0"/>
166+
<property key="labeling/shapeRadiiMapUnitScale" value="0,0,0,0,0,0"/>
167+
<property key="labeling/shapeRadiiUnits" value="1"/>
168+
<property key="labeling/shapeRadiiX" value="0"/>
169+
<property key="labeling/shapeRadiiY" value="0"/>
170+
<property key="labeling/shapeRotation" value="0"/>
171+
<property key="labeling/shapeRotationType" value="0"/>
172+
<property key="labeling/shapeSVGFile" value=""/>
173+
<property key="labeling/shapeSizeMapUnitScale" value="0,0,0,0,0,0"/>
174+
<property key="labeling/shapeSizeType" value="0"/>
175+
<property key="labeling/shapeSizeUnits" value="1"/>
176+
<property key="labeling/shapeSizeX" value="0"/>
177+
<property key="labeling/shapeSizeY" value="0"/>
178+
<property key="labeling/shapeTransparency" value="0"/>
179+
<property key="labeling/shapeType" value="0"/>
180+
<property key="labeling/substitutions" value="&lt;substitutions/>"/>
181+
<property key="labeling/textColorA" value="255"/>
182+
<property key="labeling/textColorB" value="0"/>
183+
<property key="labeling/textColorG" value="0"/>
184+
<property key="labeling/textColorR" value="0"/>
185+
<property key="labeling/textTransp" value="0"/>
186+
<property key="labeling/upsidedownLabels" value="0"/>
187+
<property key="labeling/useSubstitutions" value="false"/>
188+
<property key="labeling/wrapChar" value=""/>
189+
<property key="labeling/xOffset" value="0"/>
190+
<property key="labeling/yOffset" value="0"/>
191+
<property key="labeling/zIndex" value="0"/>
192+
<property key="variableNames"/>
193+
<property key="variableValues"/>
194+
</customproperties>
195+
<blendMode>0</blendMode>
196+
<featureBlendMode>0</featureBlendMode>
197+
<layerTransparency>0</layerTransparency>
198+
<displayfield>Name</displayfield>
199+
<label>0</label>
200+
<labelattributes>
201+
<label fieldname="" text="Label"/>
202+
<family fieldname="" name="Cantarell"/>
203+
<size fieldname="" units="pt" value="12"/>
204+
<bold fieldname="" on="0"/>
205+
<italic fieldname="" on="0"/>
206+
<underline fieldname="" on="0"/>
207+
<strikeout fieldname="" on="0"/>
208+
<color fieldname="" red="0" blue="0" green="0"/>
209+
<x fieldname=""/>
210+
<y fieldname=""/>
211+
<offset x="0" y="0" units="pt" yfieldname="" xfieldname=""/>
212+
<angle fieldname="" value="0" auto="0"/>
213+
<alignment fieldname="" value="center"/>
214+
<buffercolor fieldname="" red="255" blue="255" green="255"/>
215+
<buffersize fieldname="" units="pt" value="1"/>
216+
<bufferenabled fieldname="" on=""/>
217+
<multilineenabled fieldname="" on=""/>
218+
<selectedonly on=""/>
219+
</labelattributes>
220+
<SingleCategoryDiagramRenderer diagramType="Histogram" sizeLegend="0" attributeLegend="1">
221+
<DiagramCategory penColor="#000000" labelPlacementMethod="XHeight" penWidth="0" diagramOrientation="Up" sizeScale="0,0,0,0,0,0" minimumSize="0" barWidth="5" penAlpha="255" maxScaleDenominator="1e+08" backgroundColor="#ffffff" transparency="0" width="15" scaleDependency="Area" backgroundAlpha="255" angleOffset="1440" scaleBasedVisibility="0" enabled="0" height="15" lineSizeScale="0,0,0,0,0,0" sizeType="MM" lineSizeType="MM" minScaleDenominator="inf">
222+
<fontProperties description="Cantarell,11,-1,5,50,0,0,0,0,0" style=""/>
223+
</DiagramCategory>
224+
<symbol alpha="1" clip_to_extent="1" type="marker" name="sizeSymbol">
225+
<layer pass="0" class="SimpleMarker" locked="0">
226+
<prop k="angle" v="0"/>
227+
<prop k="color" v="255,0,0,255"/>
228+
<prop k="horizontal_anchor_point" v="1"/>
229+
<prop k="joinstyle" v="bevel"/>
230+
<prop k="name" v="circle"/>
231+
<prop k="offset" v="0,0"/>
232+
<prop k="offset_map_unit_scale" v="0,0,0,0,0,0"/>
233+
<prop k="offset_unit" v="MM"/>
234+
<prop k="outline_color" v="0,0,0,255"/>
235+
<prop k="outline_style" v="solid"/>
236+
<prop k="outline_width" v="0"/>
237+
<prop k="outline_width_map_unit_scale" v="0,0,0,0,0,0"/>
238+
<prop k="outline_width_unit" v="MM"/>
239+
<prop k="scale_method" v="diameter"/>
240+
<prop k="size" v="2"/>
241+
<prop k="size_map_unit_scale" v="0,0,0,0,0,0"/>
242+
<prop k="size_unit" v="MM"/>
243+
<prop k="vertical_anchor_point" v="1"/>
244+
</layer>
245+
</symbol>
246+
</SingleCategoryDiagramRenderer>
247+
<DiagramLayerSettings yPosColumn="-1" showColumn="-1" linePlacementFlags="10" placement="0" dist="0" xPosColumn="-1" priority="0" obstacle="0" zIndex="0" showAll="1"/>
248+
<annotationform></annotationform>
249+
<aliases>
250+
<alias field="Name" index="0" name=""/>
251+
<alias field="Value" index="1" name=""/>
252+
</aliases>
253+
<excludeAttributesWMS/>
254+
<excludeAttributesWFS/>
255+
<attributeactions default="-1"/>
256+
<attributetableconfig actionWidgetStyle="dropDown" sortExpression="" sortOrder="1664710748">
257+
<columns>
258+
<column width="-1" hidden="0" type="field" name="Name"/>
259+
<column width="-1" hidden="0" type="field" name="Value"/>
260+
<column width="-1" hidden="1" type="actions"/>
261+
</columns>
262+
</attributetableconfig>
263+
<editform></editform>
264+
<editforminit/>
265+
<editforminitcodesource>0</editforminitcodesource>
266+
<editforminitfilepath></editforminitfilepath>
267+
<editforminitcode><![CDATA[# -*- coding: utf-8 -*-
268+
"""
269+
QGIS forms can have a Python function that is called when the form is
270+
opened.
271+
272+
Use this function to add extra logic to your forms.
273+
274+
Enter the name of the function in the "Python Init function"
275+
field.
276+
An example follows:
277+
"""
278+
from qgis.PyQt.QtWidgets import QWidget
279+
280+
def my_form_open(dialog, layer, feature):
281+
geom = feature.geometry()
282+
control = dialog.findChild(QWidget, "MyLineEdit")
283+
]]></editforminitcode>
284+
<featformsuppress>0</featformsuppress>
285+
<editorlayout>generatedlayout</editorlayout>
286+
<widgets/>
287+
<conditionalstyles>
288+
<rowstyles/>
289+
<fieldstyles/>
290+
</conditionalstyles>
291+
<defaults>
292+
<default field="Name" expression=""/>
293+
<default field="Value" expression=""/>
294+
</defaults>
295+
<previewExpression></previewExpression>
296+
<layerGeometryType>2</layerGeometryType>
297+
</qgis>

0 commit comments

Comments
 (0)