Skip to content

Commit 0ad4a24

Browse files
hebersgitocruze
authored andcommitted
test: added a test for symbols with transparent fill and nontransparent stroke
1 parent c36ba71 commit 0ad4a24

File tree

4 files changed

+82
-0
lines changed

4 files changed

+82
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!DOCTYPE qgis PUBLIC 'http://mrcc.com/qgis.dtd' 'SYSTEM'>
2+
<qgis version="3.28.0-Firenze">
3+
<renderer-v2 type="RuleRenderer">
4+
<rules key="renderer_rules">
5+
<rule key="renderer_rule_0" symbol="0" label="QGIS Simple Symbol"/>
6+
</rules>
7+
<symbols>
8+
<symbol type="marker" name="0">
9+
<layer class="SimpleMarker">
10+
<Option type="Map">
11+
<Option name="angle" value="0" type="QString"/>
12+
<Option value="255,60,60,0" name="color" type="QString"/>
13+
<Option name="name" value="circle" type="QString"/>
14+
<Option name="outline_color" value="35,35,35,255" type="QString"/>
15+
<Option name="outline_style" value="solid" type="QString"/>
16+
<Option name="outline_width" value="0" type="QString"/>
17+
<Option name="outline_width_map_unit_scale" value="3x:0,0,0,0,0,0" type="QString"/>
18+
<Option name="outline_width_unit" value="Pixel" type="QString"/>
19+
<Option name="size" value="4" type="QString"/>
20+
<Option name="size_map_unit_scale" value="3x:0,0,0,0,0,0" type="QString"/>
21+
<Option name="size_unit" value="Pixel" type="QString"/>
22+
</Option>
23+
</layer>
24+
</symbol>
25+
</symbols>
26+
</renderer-v2>
27+
</qgis>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!DOCTYPE qgis PUBLIC 'http://mrcc.com/qgis.dtd' 'SYSTEM'>
2+
<qgis version="3.22.16-Białowieża">
3+
<renderer-v2 type="RuleRenderer">
4+
<rules key="renderer_rules">
5+
<rule key="renderer_rule_0" symbol="0" label="QGIS Simple Symbol"/>
6+
</rules>
7+
<symbols>
8+
<symbol type="marker" name="0">
9+
<layer class="SimpleMarker">
10+
<prop k="angle" v="0"/>
11+
<prop k="color" v="255,60,60,0"/>
12+
<prop k="name" v="circle"/>
13+
<prop k="outline_color" v="35,35,35,255"/>
14+
<prop k="outline_style" v="solid"/>
15+
<prop k="outline_width" v="0"/>
16+
<prop k="outline_width_map_unit_scale" v="3x:0,0,0,0,0,0"/>
17+
<prop k="outline_width_unit" v="Pixel"/>
18+
<prop k="size" v="4"/>
19+
<prop k="size_map_unit_scale" v="3x:0,0,0,0,0,0"/>
20+
<prop k="size_unit" v="Pixel"/>
21+
</layer>
22+
</symbol>
23+
</symbols>
24+
</renderer-v2>
25+
</qgis>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { Style } from 'geostyler-style';
2+
3+
const pointSimple: Style = {
4+
name: 'QGIS Style',
5+
rules: [{
6+
name: 'QGIS Simple Symbol',
7+
symbolizers: [{
8+
kind: 'Mark',
9+
wellKnownName: 'circle',
10+
color: '#FF3C3C',
11+
fillOpacity: 0,
12+
radius: 2,
13+
opacity: 1,
14+
rotate: 0,
15+
strokeColor: '#232323',
16+
strokeOpacity: 1,
17+
strokeWidth: 0
18+
}]
19+
}]
20+
} as Style;
21+
22+
export default pointSimple;

src/QGISStyleParser.spec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import point_multiple_symbols from '../data/styles/point_multiple_symbols';
88
import point_ranges from '../data/styles/point_ranges';
99
import point_rules from '../data/styles/point_rules';
1010
import point_simple from '../data/styles/point_simple';
11+
import point_transparent_fill from '../data/styles/point_transparent_fill';
1112
import polygon_outline_only from '../data/styles/polygon_outline_only';
1213
import polygon_point_pattern_fill from '../data/styles/polygon_point_pattern_fill';
1314
import polygon_simple from '../data/styles/polygon_simple';
@@ -51,6 +52,13 @@ describe('QMLStyleParser implements StyleParser', () => {
5152
expect(geoStylerStyle).toBeDefined();
5253
expect(geoStylerStyle).toEqual(point_simple);
5354
});
55+
it('can read a QML PointSymbol with transparent fill and opaque border', async () => {
56+
expect.assertions(2);
57+
const qml = fs.readFileSync(`./data/${qmlFolder}/point_transparent_fill.qml`, 'utf8');
58+
const { output: geoStylerStyle } = await styleParser.readStyle(qml);
59+
expect(geoStylerStyle).toBeDefined();
60+
expect(geoStylerStyle).toEqual(point_transparent_fill);
61+
});
5462
it('can read a QML PointSymbolizer with an external graphic', async () => {
5563
expect.assertions(2);
5664
const qml = fs.readFileSync(`./data/${qmlFolder}/point_external_graphic.qml`, 'utf8');

0 commit comments

Comments
 (0)