Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fastkml
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Aurélien Vermylen
fastkml
Commits
22ff3b78
Commit
22ff3b78
authored
Jul 16, 2014
by
Ian Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added usage tests to clarify how to apply a style to a Document / Placemark
parent
842c6531
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
1 deletion
+52
-1
fastkml/test_main.py
fastkml/test_main.py
+52
-1
No files found.
fastkml/test_main.py
View file @
22ff3b78
...
...
@@ -686,7 +686,6 @@ class KmlFromStringTestCase( unittest.TestCase ):
self
.
assertTrue
(
'Diffrent Snippet'
in
k
.
to_string
())
class
StyleTestCase
(
unittest
.
TestCase
):
def
test_styleurl
(
self
):
...
...
@@ -711,7 +710,59 @@ class StyleTestCase( unittest.TestCase ):
self
.
assertEqual
(
f
.
to_string
(),
f2
.
to_string
())
class
StyleUsageTestCase
(
unittest
.
TestCase
):
def
test_create_document_style
(
self
):
style
=
styles
.
Style
(
styles
=
[
styles
.
PolyStyle
(
color
=
'7f000000'
)])
doc
=
kml
.
Document
(
styles
=
[
style
])
doc2
=
kml
.
Document
()
doc2
.
append_style
(
style
)
expected
=
"""
<kml:Document xmlns:kml="http://www.opengis.net/kml/2.2">
<kml:visibility>1</kml:visibility>
<kml:Style>
<kml:PolyStyle>
<kml:color>7f000000</kml:color>
<kml:fill>1</kml:fill>
<kml:outline>1</kml:outline>
</kml:PolyStyle>
</kml:Style>
</kml:Document>
"""
doc3
=
kml
.
Document
()
doc3
.
from_string
(
expected
)
self
.
assertEqual
(
doc
.
to_string
(),
doc2
.
to_string
())
self
.
assertEqual
(
doc2
.
to_string
(),
doc3
.
to_string
())
self
.
assertEqual
(
doc
.
to_string
(),
doc3
.
to_string
())
def
test_create_placemark_style
(
self
):
style
=
styles
.
Style
(
styles
=
[
styles
.
PolyStyle
(
color
=
'7f000000'
)])
place
=
kml
.
Placemark
(
styles
=
[
style
])
place2
=
kml
.
Placemark
()
place2
.
append_style
(
style
)
expected
=
"""
<kml:Placemark xmlns:kml="http://www.opengis.net/kml/2.2">
<kml:visibility>1</kml:visibility>
<kml:Style>
<kml:PolyStyle>
<kml:color>7f000000</kml:color>
<kml:fill>1</kml:fill>
<kml:outline>1</kml:outline>
</kml:PolyStyle>
</kml:Style>
</kml:Placemark>
"""
place3
=
kml
.
Placemark
()
place3
.
from_string
(
expected
)
self
.
assertEqual
(
place
.
to_string
(),
place2
.
to_string
())
self
.
assertEqual
(
place2
.
to_string
(),
place3
.
to_string
())
self
.
assertEqual
(
place
.
to_string
(),
place3
.
to_string
())
class
StyleFromStringTestCase
(
unittest
.
TestCase
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment