Changeset 17762 in josm for trunk/test/unit
- Timestamp:
- 2021-04-12T22:43:33+02:00 (4 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/ConditionFactoryTest.java
r17275 r17762 13 13 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 14 14 import net.trajano.commons.testing.UtilityClassTestUtil; 15 16 import java.lang.reflect.Method; 15 17 16 18 /** … … 43 45 UtilityClassTestUtil.assertUtilityClassWellDefined(PseudoClasses.class); 44 46 } 47 48 /** 49 * Tests that all functions have been registered to {@link ConditionFactory.PseudoClassCondition#CONDITION_MAP} 50 */ 51 @Test 52 void testAllPseudoClassesRegistered() { 53 for (Method method : PseudoClasses.class.getDeclaredMethods()) { 54 String name = method.getName().replaceFirst("^_new$", "new"); 55 Context context = name.equals("sameTags") ? Context.LINK : Context.PRIMITIVE; 56 ConditionFactory.PseudoClassCondition.createPseudoClassCondition(name, false, context); 57 ConditionFactory.PseudoClassCondition.createPseudoClassCondition(name, true, context); 58 } 59 } 45 60 } -
trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParserTest.java
r17760 r17762 89 89 @Test 90 90 void testPseudoClassCondition() throws Exception { 91 Condition c0 = ((Selector.GeneralSelector) getParser("way:area-style").selector()).conds.get(0); 91 92 Condition c1 = ((Selector.GeneralSelector) getParser("way!:area-style").selector()).conds.get(0); 92 93 Condition c2 = ((Selector.GeneralSelector) getParser("way!:areaStyle").selector()).conds.get(0); 93 94 Condition c3 = ((Selector.GeneralSelector) getParser("way!:area_style").selector()).conds.get(0); 95 assertEquals(":areaStyle", c0.toString()); 94 96 assertEquals("!:areaStyle", c1.toString()); 95 97 assertEquals("!:areaStyle", c2.toString()); 96 98 assertEquals("!:areaStyle", c3.toString()); 99 Selector tagged = getParser("way:tagged").selector(); 100 Selector notTagged = getParser("way!:tagged").selector(); 101 assertFalse(tagged.matches((new Environment(OsmUtils.createPrimitive("way"))))); 102 assertTrue(tagged.matches((new Environment(OsmUtils.createPrimitive("way building=yes"))))); 103 assertTrue(notTagged.matches((new Environment(OsmUtils.createPrimitive("way"))))); 104 assertFalse(notTagged.matches((new Environment(OsmUtils.createPrimitive("way building=yes"))))); 97 105 } 98 106
Note:
See TracChangeset
for help on using the changeset viewer.