Changeset 16533 in josm for trunk/test
- Timestamp:
- 2020-05-31T21:06:14+02:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/ComboTest.java
r16282 r16533 5 5 import static org.junit.Assert.assertTrue; 6 6 7 import java.awt.Color; 7 8 import java.util.Collections; 8 9 … … 26 27 @Rule 27 28 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 28 public JOSMTestRules test = new JOSMTestRules().main() ;29 public JOSMTestRules test = new JOSMTestRules().main().i18n("de"); 29 30 30 31 /** … … 38 39 assertTrue(p.getComponentCount() > 0); 39 40 } 41 42 @Test 43 public void testColor() { 44 Combo combo = new Combo(); 45 combo.key = "colour"; 46 combo.values = "red;green;blue;black"; 47 combo.values_context = "color"; 48 combo.delimiter = ';'; 49 combo.addToPanel(new JPanel(), Collections.<OsmPrimitive>emptyList(), false); 50 assertEquals(5, combo.combobox.getItemCount()); 51 combo.presetListEntries.stream().filter(e -> "red".equals(e.value)).findFirst().ifPresent(combo.combobox::setSelectedItem); 52 assertEquals("red", combo.getSelectedValue()); 53 assertEquals("Rot", combo.getSelectedItem().toString()); 54 assertEquals(new Color(0xFF0000), combo.getColor()); 55 combo.presetListEntries.stream().filter(e -> "green".equals(e.value)).findFirst().ifPresent(combo.combobox::setSelectedItem); 56 assertEquals("green", combo.getSelectedValue()); 57 assertEquals("Grün", combo.getSelectedItem().toString()); 58 assertEquals(new Color(0x008000), combo.getColor()); 59 combo.combobox.setSelectedItem("#135"); 60 assertEquals("#135", combo.getSelectedValue()); 61 assertEquals(new Color(0x113355), combo.getColor()); 62 combo.combobox.setSelectedItem("#123456"); 63 assertEquals("#123456", combo.getSelectedValue()); 64 assertEquals(new Color(0x123456), combo.getColor()); 65 combo.setColor(new Color(0x448822)); 66 assertEquals("#448822", combo.getSelectedValue()); 67 } 40 68 }
Note:
See TracChangeset
for help on using the changeset viewer.