Conversation
Adds behaviour tests for the parts of the data module that need no map: - KmlStyle: KML aabbggrr colors, fill, outline, width, marker hue, heading, hotspot, color modes, balloon text and computeRandomColor. - GeoJsonPolygonStyle, GeoJsonLineStringStyle, GeoJsonPointStyle: every setter notifies observers once, and the to*Options conversions carry every property. - KmlLayer parsing: document and nested folder containers, placemark properties and extended data, shared and inline styles, polygons with holes, ground overlays and placemarks across nested folders. data line coverage goes from 57.1% to 68.2%. Five tests are ignored because they document bugs found while writing them: - KmlStyle random icon color mode randomizes the hue value instead of the color, so a green marker turns blue. - GeoJsonLineStringStyle.toPolylineOptions drops the pattern and caps. - Styles referenced through a StyleMap are never applied. - A shared Style without an id crashes KmlLayer. - A ground overlay without a LatLonBox (gx:LatLonQuad) crashes KmlLayer.
Contributor
Code Coverage
Files
|
…ugs (#1809) - KmlLayer resolved StyleMap entries with their leading '#' while shared styles are keyed by bare id, so placemarks styled through a StyleMap were unstyled. - KmlLayer no longer throws on a shared Style or StyleMap without an id; they are skipped since nothing can reference them. - KmlLayer no longer throws on a GroundOverlay without a LatLonBox (for example gx:LatLonQuad); the overlay is skipped with a warning. - GeoJsonLineStringStyle.toPolylineOptions now keeps the pattern and the start and end caps. - KmlStyle random icon color mode now randomizes the marker color instead of its hue, so markers keep their color family. The regression tests from the data coverage tests are no longer ignored.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
First test-coverage PR for the
datamodule: behaviour tests for the parts that need no map.KmlStyleTest: KMLaabbggrrcolors (8 and 6 digits, whitespace), fill, outline and width, marker hue, heading and hotspot (fraction and fallback units), color modes, balloon text, setters, andcomputeRandomColor.GeoJsonStylesTest: polygon, line string and point styles. Every setter notifies observers exactly once (GeoJsonLayerredraws from those notifications), andtoPolygonOptions/toPolylineOptions/toMarkerOptionscarry every property.KmlLayerParsingTest: howKmlLayerturns KML into its model: document and nested folder containers, placemark properties andExtendedData, shared and inline styles, polygons with holes, ground overlays, and placemarks across nested folders.Coverage
datalinesdatabranchesKmlStyleGeoJsonPolygonStyle/LineStringStyle/PointStyleKmlPolygonKmlLayerBugs found
Five tests are
@Ignored because they document bugs found while writing them. Each was confirmed to fail with the@Ignoreremoved, and each has a comment explaining the cause.StyleMapstyles are never applied. Style maps store the normalstyleUrlwith its#("#red"), shared styles are keyed by bare id ("red"), so a placemark styled through aStyleMapends up unstyled. Google Earth exports use aStyleMapon almost every placemark.<Style>without anidcrashesKmlLayer(NullPointerExceptionfromit.id!!).GroundOverlaywithout aLatLonBoxcrashesKmlLayer(latLonBox!!). Google Earth writesgx:LatLonQuadinstead of aLatLonBoxfor rotated overlays.GeoJsonLineStringStyle.toPolylineOptionsdrops the pattern and the start/end caps. InsidePolylineOptions().apply { }, the unqualifiedgetPattern()/getStartCap()/getEndCap()resolve to the new options' own getters, so the defaults are copied instead of the style's values.KmlStylerandom icon color mode randomizes the hue instead of the color.getMarkerOptionspasses the hue (0 to 360) tocomputeRandomColor, which expects ARGB, so a green marker turns blue.Bugs 2 and 3 are reachable with untrusted input. These are left for a follow-up fix PR so they show up as
fix:entries in the changelog; removing each@Ignoreis the test for its fix.Testing
./gradlew :data:testDebugUnitTest: 187 tests, 0 failures, 5 skipped (the known bugs above).:data:lintDebugpasses; its 8 findings are existing warnings in production code.