diff options
| author | koem <spam@petoria.de> | 2013-02-12 04:04:13 -0800 |
|---|---|---|
| committer | koem <spam@petoria.de> | 2013-02-12 04:04:13 -0800 |
| commit | 7b4a0b337a5f22bf0058c22967da94faea9ce318 (patch) | |
| tree | a9991f02c99d417e2517f8831c6505e385ee8459 /tests/src | |
| parent | 70251c24f5fafeeb150a2142249245e9515f560b (diff) | |
| parent | 3c3b9bb7f748bd43126e39a83268d23056db6ca6 (diff) | |
| download | cgeo-7b4a0b337a5f22bf0058c22967da94faea9ce318.zip cgeo-7b4a0b337a5f22bf0058c22967da94faea9ce318.tar.gz cgeo-7b4a0b337a5f22bf0058c22967da94faea9ce318.tar.bz2 | |
Merge pull request #2465 from koem/oc_icons
Icons for OC
Diffstat (limited to 'tests/src')
| -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)); + } + } |
