Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/stefan-niedermann/nextcloud-deck.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
authorStefan Niedermann <info@niedermann.it>2020-05-08 10:42:20 +0300
committerNiedermann IT-Dienstleistungen <stefan-niedermann@users.noreply.github.com>2020-05-08 10:57:36 +0300
commitf3f6045f878101db62a529c3ce3061ff205d1954 (patch)
treeeb8a8369eb4aef99ea9d162f13f3ca51e00c5ca0 /app/src
parentc6323e500bfa35e35ef9e099e0f960ebffff4e18 (diff)
#466 App crashes on startup when using certain Nextcloud theme colors
Negative test cases
Diffstat (limited to 'app/src')
-rw-r--r--app/src/androidTest/java/it/niedermann/nextcloud/deck/util/ColorUtilTest.java18
1 files changed, 10 insertions, 8 deletions
diff --git a/app/src/androidTest/java/it/niedermann/nextcloud/deck/util/ColorUtilTest.java b/app/src/androidTest/java/it/niedermann/nextcloud/deck/util/ColorUtilTest.java
index 3366369d0..ee9c129b2 100644
--- a/app/src/androidTest/java/it/niedermann/nextcloud/deck/util/ColorUtilTest.java
+++ b/app/src/androidTest/java/it/niedermann/nextcloud/deck/util/ColorUtilTest.java
@@ -6,7 +6,9 @@ import androidx.annotation.ColorInt;
import androidx.core.util.Pair;
import androidx.test.ext.junit.runners.AndroidJUnit4;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import java.util.ArrayList;
@@ -97,6 +99,9 @@ public class ColorUtilTest {
}
}
+ @Rule
+ public final ExpectedException exception = ExpectedException.none();
+
@Test
public void testGetCleanHexaColorString() {
final List<Pair<String, String>> validColors = new ArrayList<>();
@@ -108,13 +113,10 @@ public class ColorUtilTest {
assertEquals("Expect " + color.first + " to be cleaned up to " + color.second, color.second, ColorUtil.getCleanHexaColorString(color.first));
}
- // TODO
-// final String[] invalidColors = new String[]{null, "", "cc", "c", "#a"};
-// for (@ColorInt int color : LIGHT_COLORS) {
-// assertThrows(
-// "Expect " + String.format("#%06X", (0xFFFFFF & color)) + " to be a light color",
-// ColorUtil.isColorDark(color)
-// );
-// }
+ final String[] invalidColors = new String[]{null, "", "cc", "c", "#a"};
+ for (String color : invalidColors) {
+ exception.expect(IllegalArgumentException.class);
+ ColorUtil.getCleanHexaColorString(color);
+ }
}
}