Changeset 14801 in josm


Ignore:
Timestamp:
2019-02-23T16:52:43+01:00 (3 months ago)
Author:
Don-vip
Message:

fix #17358 - mapcss regular expression matches for key (patch by michael2402, regression from #17021)

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ConditionFactory.java

    r14484 r14801  
    316316        }
    317317
     318        /**
     319         * Determines if this condition requires an exact key match.
     320         * @return {@code true} if this condition requires an exact key match.
     321         * @since 14801
     322         */
     323        public boolean requiresExactKeyMatch() {
     324            return !Op.NEGATED_OPS.contains(op);
     325        }
     326
    318327        @Override
    319328        public boolean applies(Environment env) {
     
    388397            super(k, v, op, false);
    389398            this.keyPattern = Pattern.compile(k);
     399        }
     400
     401        @Override
     402        public boolean requiresExactKeyMatch() {
     403            return false;
    390404        }
    391405
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSource.java

    r14746 r14801  
    5353import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.KeyMatchType;
    5454import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.KeyValueCondition;
    55 import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.Op;
    5655import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.PseudoClassCondition;
    5756import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.SimpleKeyValueCondition;
     
    333332                } else if (c instanceof KeyValueCondition) {
    334333                    KeyValueCondition keyValueCondition = (KeyValueCondition) c;
    335                     if (!Op.NEGATED_OPS.contains(keyValueCondition.op)) {
     334                    if (keyValueCondition.requiresExactKeyMatch()) {
    336335                        key = keyValueCondition.k;
    337336                    }
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MapCSSTagCheckerTest.java

    r14796 r14801  
    332332     */
    333333    @Test
    334     @Ignore("not fixed yet")
    335334    public void testTicket17358() throws ParseException {
    336335        final Collection<TestError> errors = buildTagChecker(
Note: See TracChangeset for help on using the changeset viewer.