Ignore:
Timestamp:
2016-08-18T03:39:22+02:00 (6 years ago)
Author:
Don-vip
Message:

see #11924 - extract MapCSS conditions to new class ConditionFactory (on the same model than ExpressionFactory) - should workaround Groovy bug with Java 9 (https://issues.apache.org/jira/browse/GROOVY-7879 ?)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/KeyConditionTest.groovy

    r9214 r10837  
    1313import org.openstreetmap.josm.gui.mappaint.Environment
    1414import org.openstreetmap.josm.gui.mappaint.mapcss.Condition.Context
     15import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.KeyMatchType
    1516
    1617class KeyConditionTest {
     
    4748
    4849        // ["a label"]
    49         Condition c = Condition.createKeyCondition("a key", false, Condition.KeyMatchType.FALSE, Context.PRIMITIVE)
     50        Condition c = ConditionFactory.createKeyCondition("a key", false, KeyMatchType.FALSE, Context.PRIMITIVE)
    5051        // ["a label"?]
    51         c = Condition.createKeyCondition("a key", false, Condition.KeyMatchType.TRUE, Context.PRIMITIVE)
     52        c = ConditionFactory.createKeyCondition("a key", false, KeyMatchType.TRUE, Context.PRIMITIVE)
    5253        // [!"a label"]
    53         c = Condition.createKeyCondition("a key", true, Condition.KeyMatchType.FALSE, Context.PRIMITIVE)
     54        c = ConditionFactory.createKeyCondition("a key", true, KeyMatchType.FALSE, Context.PRIMITIVE)
    5455        // [!"a label"?]
    55         c = Condition.createKeyCondition("a key", true, Condition.KeyMatchType.TRUE, Context.PRIMITIVE)
     56        c = ConditionFactory.createKeyCondition("a key", true, KeyMatchType.TRUE, Context.PRIMITIVE)
    5657
    5758        // ["a label"]
    58         c = Condition.createKeyCondition("a key", false, null, Context.LINK)
     59        c = ConditionFactory.createKeyCondition("a key", false, null, Context.LINK)
    5960        // [!"a label"]
    60         c = Condition.createKeyCondition("a key", true, null, Context.LINK)
     61        c = ConditionFactory.createKeyCondition("a key", true, null, Context.LINK)
    6162
    6263        shouldFail(MapCSSException) {
    6364            // ["a label"?]
    64            c = Condition.createKeyCondition("a key", false, Condition.KeyMatchType.TRUE, Context.LINK)
     65           c = ConditionFactory.createKeyCondition("a key", false, KeyMatchType.TRUE, Context.LINK)
    6566        }
    6667
    6768        shouldFail(MapCSSException) {
    6869            // [!"a label"?]
    69             c = Condition.createKeyCondition("a key", true, Condition.KeyMatchType.TRUE, Context.LINK)
     70            c = ConditionFactory.createKeyCondition("a key", true, KeyMatchType.TRUE, Context.LINK)
    7071        }
    7172    }
     
    7980        Environment e = new Environment(n).withParent(r).withIndex(0, r.membersCount).withLinkContext()
    8081
    81         Condition cond = Condition.createKeyCondition("my_role", false, null, Context.LINK)
     82        Condition cond = ConditionFactory.createKeyCondition("my_role", false, null, Context.LINK)
    8283        assert cond.applies(e)
    8384
    84         cond = Condition.createKeyCondition("my_role", true, null, Context.LINK)
     85        cond = ConditionFactory.createKeyCondition("my_role", true, null, Context.LINK)
    8586        assert !cond.applies(e)
    8687    }
     
    9495        Environment e = new Environment(n).withParent(r).withIndex(0, r.membersCount).withLinkContext()
    9596
    96         Condition cond = Condition.createKeyCondition("another_role", false, null, Context.LINK)
     97        Condition cond = ConditionFactory.createKeyCondition("another_role", false, null, Context.LINK)
    9798        assert !cond.applies(e)
    9899
    99         cond = Condition.createKeyCondition("another_role", true, null, Context.LINK)
     100        cond = ConditionFactory.createKeyCondition("another_role", true, null, Context.LINK)
    100101        assert cond.applies(e)
    101102    }
Note: See TracChangeset for help on using the changeset viewer.