Changeset 17609 in josm for trunk/test


Ignore:
Timestamp:
2021-03-20T23:07:02+01:00 (4 years ago)
Author:
simon04
Message:

see #18949 - Extract class TaggingPresetItemGuiSupport

Location:
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/CheckGroupTest.java

    r17275 r17609  
    66import static org.junit.jupiter.api.Assertions.assertTrue;
    77
    8 import java.util.Collections;
    9 
    108import javax.swing.JPanel;
    119
     
    1311import org.junit.jupiter.api.Test;
    1412import org.openstreetmap.josm.JOSMFixture;
    15 import org.openstreetmap.josm.data.osm.OsmPrimitive;
     13import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
    1614
    1715/**
     
    3634        JPanel p = new JPanel();
    3735        assertEquals(0, p.getComponentCount());
    38         assertFalse(cg.addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));
     36        assertFalse(cg.addToPanel(p, TaggingPresetItemGuiSupport.create(false)));
    3937        assertTrue(p.getComponentCount() > 0);
    4038    }
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/CheckTest.java

    r17275 r17609  
    55import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    7 import java.util.Collections;
    8 
    97import javax.swing.JPanel;
    108
    119import org.junit.jupiter.api.extension.RegisterExtension;
    1210import org.junit.jupiter.api.Test;
    13 import org.openstreetmap.josm.data.osm.OsmPrimitive;
     11import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
    1412import org.openstreetmap.josm.testutils.JOSMTestRules;
    1513
     
    3533        JPanel p = new JPanel();
    3634        assertEquals(0, p.getComponentCount());
    37         assertTrue(new Check().addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));
     35        assertTrue(new Check().addToPanel(p, TaggingPresetItemGuiSupport.create(false)));
    3836        assertTrue(p.getComponentCount() > 0);
    3937    }
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/ComboTest.java

    r17275 r17609  
    66
    77import java.awt.Color;
    8 import java.util.Arrays;
    9 import java.util.Collections;
    108
    119import javax.swing.JPanel;
     
    1513import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1614import org.openstreetmap.josm.data.osm.OsmUtils;
     15import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
    1716import org.openstreetmap.josm.testutils.JOSMTestRules;
    1817
     
    3837        JPanel p = new JPanel();
    3938        assertEquals(0, p.getComponentCount());
    40         assertTrue(new Combo().addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));
     39        assertTrue(new Combo().addToPanel(p, TaggingPresetItemGuiSupport.create(false)));
    4140        assertTrue(p.getComponentCount() > 0);
    4241    }
     
    5554        OsmPrimitive waySI = OsmUtils.createPrimitive("way addr:country=SI");
    5655
    57         combo.addToPanel(new JPanel(), Collections.singleton(way), false);
     56        combo.addToPanel(new JPanel(), TaggingPresetItemGuiSupport.create(false, way));
    5857        assertEquals("", combo.getSelectedValue());
    5958
    6059        combo.default_ = "SI";
    61         combo.addToPanel(new JPanel(), Collections.singleton(way), false);
     60        combo.addToPanel(new JPanel(), TaggingPresetItemGuiSupport.create(false, way));
    6261        assertEquals("SI", combo.getSelectedValue());
    63         combo.addToPanel(new JPanel(), Collections.singleton(wayAT), false);
     62        combo.addToPanel(new JPanel(), TaggingPresetItemGuiSupport.create(false, wayAT));
    6463        assertEquals("AT", combo.getSelectedValue());
    6564        combo.default_ = null;
     
    6766        KeyedItem.LAST_VALUES.clear();
    6867        KeyedItem.LAST_VALUES.put("addr:country", "AT");
    69         combo.addToPanel(new JPanel(), Collections.singleton(way), false);
     68        combo.addToPanel(new JPanel(), TaggingPresetItemGuiSupport.create(false, way));
    7069        assertEquals("AT", combo.getSelectedValue());
    71         combo.addToPanel(new JPanel(), Collections.singleton(wayAT), true);
     70        combo.addToPanel(new JPanel(), TaggingPresetItemGuiSupport.create(true, wayAT));
    7271        assertEquals("AT", combo.getSelectedValue());
    73         combo.addToPanel(new JPanel(), Collections.singleton(way), true);
     72        combo.addToPanel(new JPanel(), TaggingPresetItemGuiSupport.create(true));
    7473        assertEquals("", combo.getSelectedValue());
    7574        combo.use_last_as_default = 2; // "force"
    76         combo.addToPanel(new JPanel(), Collections.singleton(way), true);
     75        combo.addToPanel(new JPanel(), TaggingPresetItemGuiSupport.create(true));
    7776        assertEquals("AT", combo.getSelectedValue());
    7877        KeyedItem.LAST_VALUES.clear();
    7978
    80         combo.addToPanel(new JPanel(), Arrays.asList(wayAT, waySI), true);
     79        combo.addToPanel(new JPanel(), TaggingPresetItemGuiSupport.create(true, wayAT, waySI));
    8180        assertEquals(Combo.DIFFERENT, combo.getSelectedValue());
    8281    }
     
    8988        combo.values_context = "color";
    9089        combo.delimiter = ';';
    91         combo.addToPanel(new JPanel(), Collections.<OsmPrimitive>emptyList(), false);
     90        combo.addToPanel(new JPanel(), TaggingPresetItemGuiSupport.create(false));
    9291        assertEquals(5, combo.combobox.getItemCount());
    9392        combo.presetListEntries.stream().filter(e -> "red".equals(e.value)).findFirst().ifPresent(combo.combobox::setSelectedItem);
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/ItemSeparatorTest.java

    r17275 r17609  
    66import static org.junit.jupiter.api.Assertions.assertTrue;
    77
    8 import java.util.Collections;
    9 
    108import javax.swing.JPanel;
    119
     
    1311import org.junit.jupiter.api.Test;
    1412import org.openstreetmap.josm.JOSMFixture;
    15 import org.openstreetmap.josm.data.osm.OsmPrimitive;
     13import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
    1614
    1715/**
     
    3533        JPanel p = new JPanel();
    3634        assertEquals(0, p.getComponentCount());
    37         assertFalse(new ItemSeparator().addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));
     35        assertFalse(new ItemSeparator().addToPanel(p, TaggingPresetItemGuiSupport.create(false)));
    3836        assertTrue(p.getComponentCount() > 0);
    3937    }
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/KeyTest.java

    r17275 r17609  
    55import static org.junit.jupiter.api.Assertions.assertFalse;
    66
    7 import java.util.Collections;
    8 
    97import javax.swing.JPanel;
    108
     
    1210import org.junit.jupiter.api.Test;
    1311import org.openstreetmap.josm.JOSMFixture;
    14 import org.openstreetmap.josm.data.osm.OsmPrimitive;
     12import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
    1513
    1614/**
     
    3432        JPanel p = new JPanel();
    3533        assertEquals(0, p.getComponentCount());
    36         assertFalse(new Key().addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));
     34        assertFalse(new Key().addToPanel(p, TaggingPresetItemGuiSupport.create(false)));
    3735        assertEquals(0, p.getComponentCount());
    3836    }
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/LabelTest.java

    r17275 r17609  
    55import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    7 import java.util.Collections;
    8 
    97import javax.swing.JPanel;
    108
     
    1210import org.junit.jupiter.api.Test;
    1311import org.openstreetmap.josm.JOSMFixture;
    14 import org.openstreetmap.josm.data.osm.OsmPrimitive;
     12import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
    1513
    1614/**
     
    3432        JPanel p = new JPanel();
    3533        assertEquals(0, p.getComponentCount());
    36         assertTrue(new Label().addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));
     34        assertTrue(new Label().addToPanel(p, TaggingPresetItemGuiSupport.create(false)));
    3735        assertTrue(p.getComponentCount() > 0);
    3836    }
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/LinkTest.java

    r17275 r17609  
    66import static org.junit.jupiter.api.Assertions.assertTrue;
    77
    8 import java.util.Collections;
    9 
    108import javax.swing.JPanel;
    119
     
    1311import org.junit.jupiter.api.Test;
    1412import org.openstreetmap.josm.JOSMFixture;
    15 import org.openstreetmap.josm.data.osm.OsmPrimitive;
     13import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
    1614import org.openstreetmap.josm.spi.preferences.Config;
    1715
     
    3735        JPanel p = new JPanel();
    3836        assertEquals(0, p.getComponentCount());
    39         assertFalse(l.addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));
     37        assertFalse(l.addToPanel(p, TaggingPresetItemGuiSupport.create(false)));
    4038        assertEquals(0, p.getComponentCount());
    4139
    4240        l.href = Config.getUrls().getJOSMWebsite();
    43         assertFalse(l.addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));
     41        assertFalse(l.addToPanel(p, TaggingPresetItemGuiSupport.create(false)));
    4442        assertTrue(p.getComponentCount() > 0);
    4543
    4644        l.locale_href = Config.getUrls().getJOSMWebsite();
    47         assertFalse(l.addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));
     45        assertFalse(l.addToPanel(p, TaggingPresetItemGuiSupport.create(false)));
    4846        assertTrue(p.getComponentCount() > 0);
    4947    }
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/MultiSelectTest.java

    r17275 r17609  
    55import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    7 import java.util.Collections;
    8 
    97import javax.swing.JPanel;
    108
     
    1210import org.junit.jupiter.api.Test;
    1311import org.openstreetmap.josm.JOSMFixture;
    14 import org.openstreetmap.josm.data.osm.OsmPrimitive;
     12import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
    1513
    1614/**
     
    3432        JPanel p = new JPanel();
    3533        assertEquals(0, p.getComponentCount());
    36         assertTrue(new MultiSelect().addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));
     34        assertTrue(new MultiSelect().addToPanel(p, TaggingPresetItemGuiSupport.create(false)));
    3735        assertTrue(p.getComponentCount() > 0);
    3836    }
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/OptionalTest.java

    r17275 r17609  
    66import static org.junit.jupiter.api.Assertions.assertTrue;
    77
    8 import java.util.Collections;
    9 
    108import javax.swing.JPanel;
    119
     
    1311import org.junit.jupiter.api.Test;
    1412import org.openstreetmap.josm.JOSMFixture;
    15 import org.openstreetmap.josm.data.osm.OsmPrimitive;
     13import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
    1614
    1715/**
     
    3533        JPanel p = new JPanel();
    3634        assertEquals(0, p.getComponentCount());
    37         assertFalse(new Optional().addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));
     35        assertFalse(new Optional().addToPanel(p, TaggingPresetItemGuiSupport.create(false)));
    3836        assertTrue(p.getComponentCount() > 0);
    3937    }
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/PresetLinkTest.java

    r17275 r17609  
    66import static org.junit.jupiter.api.Assertions.assertTrue;
    77
    8 import java.util.Collections;
    9 
    108import javax.swing.JPanel;
    119
    1210import org.junit.jupiter.api.extension.RegisterExtension;
    1311import org.junit.jupiter.api.Test;
    14 import org.openstreetmap.josm.data.osm.OsmPrimitive;
     12import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
    1513import org.openstreetmap.josm.testutils.JOSMTestRules;
    1614
     
    3836        JPanel p = new JPanel();
    3937        assertEquals(0, p.getComponentCount());
    40         assertFalse(l.addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));
     38        assertFalse(l.addToPanel(p, TaggingPresetItemGuiSupport.create(false)));
    4139        assertTrue(p.getComponentCount() > 0);
    4240    }
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/RolesTest.java

    r17275 r17609  
    66import static org.junit.jupiter.api.Assertions.assertTrue;
    77
    8 import java.util.Collections;
    9 
    108import javax.swing.JPanel;
    119
     
    1311import org.junit.jupiter.api.Test;
    1412import org.openstreetmap.josm.JOSMFixture;
    15 import org.openstreetmap.josm.data.osm.OsmPrimitive;
     13import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
    1614
    1715/**
     
    3533        JPanel p = new JPanel();
    3634        assertEquals(0, p.getComponentCount());
    37         assertFalse(new Roles().addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));
     35        assertFalse(new Roles().addToPanel(p, TaggingPresetItemGuiSupport.create(false)));
    3836        assertTrue(p.getComponentCount() > 0);
    3937    }
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/SpaceTest.java

    r17275 r17609  
    66import static org.junit.jupiter.api.Assertions.assertTrue;
    77
    8 import java.util.Collections;
    9 
    108import javax.swing.JPanel;
    119
     
    1311import org.junit.jupiter.api.Test;
    1412import org.openstreetmap.josm.JOSMFixture;
    15 import org.openstreetmap.josm.data.osm.OsmPrimitive;
     13import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
    1614
    1715/**
     
    3533        JPanel p = new JPanel();
    3634        assertEquals(0, p.getComponentCount());
    37         assertFalse(new Space().addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));
     35        assertFalse(new Space().addToPanel(p, TaggingPresetItemGuiSupport.create(false)));
    3836        assertTrue(p.getComponentCount() > 0);
    3937    }
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/TextTest.java

    r17275 r17609  
    55import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    7 import java.util.Collections;
    8 
    97import javax.swing.JPanel;
    108
    119import org.junit.jupiter.api.extension.RegisterExtension;
    1210import org.junit.jupiter.api.Test;
    13 import org.openstreetmap.josm.data.osm.OsmPrimitive;
     11import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
    1412import org.openstreetmap.josm.testutils.JOSMTestRules;
    1513
     
    3533        JPanel p = new JPanel();
    3634        assertEquals(0, p.getComponentCount());
    37         assertTrue(new Text().addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));
     35        assertTrue(new Text().addToPanel(p, TaggingPresetItemGuiSupport.create(false)));
    3836        assertTrue(p.getComponentCount() > 0);
    3937    }
Note: See TracChangeset for help on using the changeset viewer.