|
Last change
on this file since 6561 was 4074, checked in by bastiK, 15 years ago |
|
mapcss: performance improvement for parent selector (by Gubaer)
|
-
Property svn:eol-style
set to
native
|
|
File size:
1.4 KB
|
| Line | |
|---|
| 1 | // License: GPL. For details, see LICENSE file.
|
|---|
| 2 | package org.openstreetmap.josm.gui.mappaint.mapcss;
|
|---|
| 3 |
|
|---|
| 4 | import static org.junit.Assert.*
|
|---|
| 5 |
|
|---|
| 6 | import org.junit.*
|
|---|
| 7 | import org.openstreetmap.josm.fixtures.JOSMFixture
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 | class ParsingLinkSelectorTest {
|
|---|
| 11 |
|
|---|
| 12 | @BeforeClass
|
|---|
| 13 | public static void createJOSMFixture(){
|
|---|
| 14 | JOSMFixture.createUnitTestFixture().init()
|
|---|
| 15 | }
|
|---|
| 16 |
|
|---|
| 17 | @Test
|
|---|
| 18 | public void parseEmptyChildSelector() {
|
|---|
| 19 | def css = """
|
|---|
| 20 | relation > way {}
|
|---|
| 21 | """
|
|---|
| 22 | MapCSSStyleSource source = new MapCSSStyleSource(css)
|
|---|
| 23 | source.loadStyleSource()
|
|---|
| 24 | assert source.rules.size() == 1
|
|---|
| 25 | }
|
|---|
| 26 |
|
|---|
| 27 | @Test
|
|---|
| 28 | public void parseEmptyParentSelector() {
|
|---|
| 29 | def css = """
|
|---|
| 30 | way < relation {}
|
|---|
| 31 | """
|
|---|
| 32 | MapCSSStyleSource source = new MapCSSStyleSource(css)
|
|---|
| 33 | source.loadStyleSource()
|
|---|
| 34 | assert source.rules.size() == 1
|
|---|
| 35 | }
|
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 | @Test
|
|---|
| 39 | public void parseChildSelectorWithKeyValueCondition() {
|
|---|
| 40 | def css = """
|
|---|
| 41 | relation >[role="my_role"] way {}
|
|---|
| 42 | """
|
|---|
| 43 | MapCSSStyleSource source = new MapCSSStyleSource(css)
|
|---|
| 44 | source.loadStyleSource()
|
|---|
| 45 | assert source.rules.size() == 1
|
|---|
| 46 | }
|
|---|
| 47 |
|
|---|
| 48 | @Test
|
|---|
| 49 | public void parseChildSelectorWithKeyCondition() {
|
|---|
| 50 | def css = """
|
|---|
| 51 | relation >["my_role"] way{}
|
|---|
| 52 | """
|
|---|
| 53 | MapCSSStyleSource source = new MapCSSStyleSource(css)
|
|---|
| 54 | source.loadStyleSource()
|
|---|
| 55 | assert source.rules.size() == 1
|
|---|
| 56 | }
|
|---|
| 57 | }
|
|---|
| 58 |
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.