source: josm/trunk/test/unit/org/openstreetmap/josm/data/PreferencesTest.groovy@ 6774

Last change on this file since 6774 was 6774, checked in by simon04, 11 years ago

fix #9633 - MapCSS: allow (named) colours with alpha

File size: 943 bytes
Line 
1package org.openstreetmap.josm.data
2
3import org.openstreetmap.josm.Main
4
5import java.awt.Color
6
7class PreferencesTest extends GroovyTestCase {
8 @Override
9 void setUp() {
10 Main.initApplicationPreferences()
11 }
12
13 void testColorName() {
14 assert Main.pref.getColorName("color.layer {5DE308C0-916F-4B5A-B3DB-D45E17F30172}.gpx") == "color.layer {5DE308C0-916F-4B5A-B3DB-D45E17F30172}.gpx"
15 }
16
17 void testColorAlpha() {
18 assert Main.pref.getColor("foo", new Color(0x12345678, true)).alpha == 0x12
19 assert Main.pref.putColor("bar", new Color(0x12345678, true))
20 assert Main.pref.getColor("bar", null).alpha == 0x12
21 }
22
23 void testColorNameAlpha() {
24 assert Main.pref.getColor("foo", "bar", new Color(0x12345678, true)).alpha == 0x12
25 assert Main.pref.getDefaultColor("foo") == new Color(0x34, 0x56, 0x78, 0x12)
26 assert Main.pref.getDefaultColor("foo").alpha == 0x12
27 }
28}
Note: See TracBrowser for help on using the repository browser.