diff options
author | koem <koem@petoria.de> | 2013-02-11 11:26:50 +1300 |
---|---|---|
committer | koem <koem@petoria.de> | 2013-02-12 20:26:49 +1300 |
commit | c1228f54411e11f373efb9c9d3205ec04ff9c0c7 (patch) | |
tree | ef2e0c172e69ffe421fe25ae7dd4dd07c0c69839 /tests/src/cgeo | |
parent | ebd1152b95585bc89221660534ad8e26701c26cd (diff) | |
download | cgeo-c1228f54411e11f373efb9c9d3205ec04ff9c0c7.zip cgeo-c1228f54411e11f373efb9c9d3205ec04ff9c0c7.tar.gz cgeo-c1228f54411e11f373efb9c9d3205ec04ff9c0c7.tar.bz2 |
Unit-Tests ++
- and Maintenance Icon Color changed to alert-red
Diffstat (limited to 'tests/src/cgeo')
-rw-r--r-- | tests/src/cgeo/geocaching/enumerations/CacheAttributeTest.java | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/tests/src/cgeo/geocaching/enumerations/CacheAttributeTest.java b/tests/src/cgeo/geocaching/enumerations/CacheAttributeTest.java index f369b0e..e5573ba 100644 --- a/tests/src/cgeo/geocaching/enumerations/CacheAttributeTest.java +++ b/tests/src/cgeo/geocaching/enumerations/CacheAttributeTest.java @@ -6,7 +6,7 @@ public class CacheAttributeTest extends AndroidTestCase { public static void testTrimAttributeName() { for (CacheAttribute attribute : CacheAttribute.values()) { - final String rawName = attribute.gcRawName; + final String rawName = attribute.rawName; assertTrue("bad attribute name " + rawName, CacheAttribute.trimAttributeName(rawName).equals(rawName)); } } @@ -14,10 +14,39 @@ public class CacheAttributeTest extends AndroidTestCase { public static void testIds() { for (CacheAttribute attribute : CacheAttribute.values()) { if (attribute != CacheAttribute.UNKNOWN) { + assertTrue(attribute.rawName != null); + assertTrue(attribute.rawName.length() > 0); assertTrue(attribute.drawableId != 0); assertTrue(attribute.stringIdYes != 0); assertTrue(attribute.stringIdNo != 0); } } } + + public static void testGetL10n() { + CacheAttribute attribute = CacheAttribute.HIKING; + // This test is language dependend. It does not make sense to test it + // with every attribute. We just want to know if getL10n works + // correctly + assertFalse("_yes and _no must not have the same translation", + attribute.getL10n(true).equals(attribute.getL10n(false))); + } + + public static void testGetBy() { + CacheAttribute attribute = CacheAttribute.HIKING; // an attribute that is present in GC and OC + assertTrue("Test cannot be run with this attribute", attribute.gcid >= 0); + assertTrue("Test cannot be run with this attribute", attribute.ocid >= 0); + assertSame(CacheAttribute.getByRawName(attribute.rawName), attribute); + assertSame(CacheAttribute.getByGcId(attribute.gcid), attribute); + assertSame(CacheAttribute.getByOcId(attribute.ocid), attribute); + } + + public static void testIsEnabled() { + CacheAttribute attribute = CacheAttribute.HIKING; + String hiking_yes = attribute.getAttributeName(true); + String hiking_no = attribute.getAttributeName(false); + assertTrue(CacheAttribute.isEnabled(hiking_yes)); + assertFalse(CacheAttribute.isEnabled(hiking_no)); + } + } |