[Android] Unit tests for Tools

Geoffrey Métais git at videolan.org
Thu Jun 8 14:12:52 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Jun  8 10:15:35 2017 +0200| [76df1fdbb7ea954924f22a2932b23017677b8bac] | committer: Geoffrey Métais

Unit tests for Tools

> https://code.videolan.org/videolan/vlc-android/commit/76df1fdbb7ea954924f22a2932b23017677b8bac
---

 medialibrary/build.gradle                             |  1 +
 .../java/org/videolan/medialibrary/ToolsTest.java     | 19 +++++++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/medialibrary/build.gradle b/medialibrary/build.gradle
index 1b06fe690..9fcb7828a 100644
--- a/medialibrary/build.gradle
+++ b/medialibrary/build.gradle
@@ -66,4 +66,5 @@ dependencies {
     compile "com.android.support:support-v4:$rootProject.ext.appCompatVersion"
     compile "com.android.support:support-compat:$rootProject.ext.appCompatVersion"
     compile "com.android.support:support-fragment:$rootProject.ext.appCompatVersion"
+    testCompile 'junit:junit:4.12'
 }
\ No newline at end of file
diff --git a/medialibrary/src/test/java/org/videolan/medialibrary/ToolsTest.java b/medialibrary/src/test/java/org/videolan/medialibrary/ToolsTest.java
new file mode 100644
index 000000000..2b0a8c5a0
--- /dev/null
+++ b/medialibrary/src/test/java/org/videolan/medialibrary/ToolsTest.java
@@ -0,0 +1,19 @@
+package org.videolan.medialibrary;
+
+import junit.framework.TestCase;
+
+public class ToolsTest extends TestCase {
+    public void testIsArrayEmpty() throws Exception {
+
+    }
+
+    public void testMillisToString() throws Exception {
+        assertEquals("3min30s", Tools.millisToString(210000, true));
+        assertEquals("3min", Tools.millisToString(180000, true));
+        assertEquals("1h30min30s", Tools.millisToString(5430000, true));
+        assertEquals("1h30min", Tools.millisToString(5400000, true));
+        assertEquals("1h30s", Tools.millisToString(3630000, true));
+        assertEquals("-32:40", Tools.millisToString(-1960000, false));
+    }
+
+}
\ No newline at end of file



More information about the Android mailing list