Skip to content

Commit

Permalink
Include a test of the get_parent method
Browse files Browse the repository at this point in the history
  • Loading branch information
spakin committed Dec 24, 2023
1 parent 2ad8d1e commit a733007
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/data/refs/sis__4a1ab1abe69fa027d5038c0ebb71073d.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Created with Inkscape (http://www.inkscape.org/) --><svg xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:cc="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" width="793.7007874" height="1122.519685">
<defs/>
<sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="0.35" inkscape:cx="375" inkscape:cy="520" inkscape:document-units="px" inkscape:current-layer="layer1"/>
<metadata>
<rdf:RDF>
<cc:Work rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
</cc:Work>
</rdf:RDF>
</metadata>
<g inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1"><g><circle cx="40" cy="20" r="8" style="stroke:black;fill:red"/><circle cx="60" cy="20" r="8" style="stroke:black;fill:red"/><circle cx="80" cy="20" r="8" style="stroke:black;fill:red"/><circle cx="100" cy="20" r="8" style="stroke:black;fill:red"/></g><g><circle cx="20" cy="40" r="8" style="stroke:black;fill:orange"/><circle cx="60" cy="40" r="8" style="stroke:black;fill:orange"/><circle cx="80" cy="40" r="8" style="stroke:black;fill:orange"/><circle cx="100" cy="40" r="8" style="stroke:black;fill:orange"/></g><g><circle cx="20" cy="60" r="8" style="stroke:black;fill:yellow"/><circle cx="40" cy="60" r="8" style="stroke:black;fill:yellow"/><circle cx="80" cy="60" r="8" style="stroke:black;fill:yellow"/><circle cx="100" cy="60" r="8" style="stroke:black;fill:yellow"/></g><g><circle cx="20" cy="80" r="8" style="stroke:black;fill:green"/><circle cx="40" cy="80" r="8" style="stroke:black;fill:green"/><circle cx="60" cy="80" r="8" style="stroke:black;fill:green"/><circle cx="100" cy="80" r="8" style="stroke:black;fill:green"/></g><g><circle cx="20" cy="100" r="8" style="stroke:black;fill:blue"/><circle cx="40" cy="100" r="8" style="stroke:black;fill:blue"/><circle cx="60" cy="100" r="8" style="stroke:black;fill:blue"/><circle cx="80" cy="100" r="8" style="stroke:black;fill:blue"/></g><g transform="translate(120, 0)"><circle cx="20" cy="20" r="8" style="stroke:black;fill:red"/><circle cx="40" cy="40" r="8" style="stroke:black;fill:orange"/><circle cx="60" cy="60" r="8" style="stroke:black;fill:yellow"/><circle cx="80" cy="80" r="8" style="stroke:black;fill:green"/><circle cx="100" cy="100" r="8" style="stroke:black;fill:blue"/></g></g>
</svg>
31 changes: 31 additions & 0 deletions tests/test_simple_inkscape_scripting.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,37 @@ class SimpInkScrTestCommonArgs(CustomComparisonMixin,
compare_file = 'svg/default-inkscape-SVG.svg'


class SimpInkScrTestCollections(CustomComparisonMixin,
InkscapeExtensionTestMixin,
TestCase):
'Test examples from the Object Collections wiki page.'
# Indicate how testing should be performed.
effect_class = SimpleInkscapeScripting
compare_filters = [CompareOrderIndependentStyle()]

# Define a sequence of tests.
comparisons = [
('''--program=
colors = ['red', 'orange', 'yellow', 'green', 'blue']
diag = []
for j in range(5):
gr = group()
for i in range(5):
c = circle((i*20 + 20, j*20 + 20), 8, fill=colors[j])
gr.append(c)
if i == j:
diag.append(c)
diag_gr = group()
for c in diag:
c.get_parent().ungroup(c)
diag_gr.append(c)
diag_gr.translate((120, 0))
''',)
]
compare_file = 'svg/default-inkscape-SVG.svg'


class SimpInkScrTestEffects(CustomComparisonMixin,
InkscapeExtensionTestMixin,
TestCase):
Expand Down

0 comments on commit a733007

Please sign in to comment.