Last change
on this file since 18918 was 18918, checked in by taylor.smock, 6 months ago |
Fix #23290: Validate the regions a tag is expected to be in (patch by Sarabjeet108, modified)
Modifications are as follows:
- Allow the use of the new
region attributes for keys inside a preset
- Basic tests
regions comes from Vespucci's extensions: https://vespucci.io/tutorials/presets/#extensions
|
-
Property svn:eol-style
set to
native
|
File size:
1.0 KB
|
Line | |
---|
1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.gui.tagging.presets.items;
|
---|
3 |
|
---|
4 | import static org.junit.jupiter.api.Assertions.assertEquals;
|
---|
5 | import static org.junit.jupiter.api.Assertions.assertFalse;
|
---|
6 |
|
---|
7 | import javax.swing.JPanel;
|
---|
8 |
|
---|
9 | import org.junit.jupiter.api.Test;
|
---|
10 | import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
|
---|
11 | import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemTest;
|
---|
12 |
|
---|
13 | /**
|
---|
14 | * Unit tests of {@link Key} class.
|
---|
15 | */
|
---|
16 | class KeyTest implements RegionSpecificTest, TaggingPresetItemTest {
|
---|
17 | @Override
|
---|
18 | public Key getInstance() {
|
---|
19 | final Key key = new Key();
|
---|
20 | key.key = "highway";
|
---|
21 | key.value = "residential";
|
---|
22 | return key;
|
---|
23 | }
|
---|
24 |
|
---|
25 | /**
|
---|
26 | * Unit test for {@link Key#addToPanel}.
|
---|
27 | */
|
---|
28 | @Test
|
---|
29 | @Override
|
---|
30 | public void testAddToPanel() {
|
---|
31 | JPanel p = new JPanel();
|
---|
32 | assertEquals(0, p.getComponentCount());
|
---|
33 | assertFalse(new Key().addToPanel(p, TaggingPresetItemGuiSupport.create(false)));
|
---|
34 | assertEquals(0, p.getComponentCount());
|
---|
35 | }
|
---|
36 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.