diff --git a/app/build.gradle b/app/build.gradle
index 0c10eb6..4842e9a 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -2,22 +2,35 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 23
- buildToolsVersion "23.0.2"
+ buildToolsVersion "23.0.3"
defaultConfig {
applicationId "org.hitlabnz.sensor_fusion_demo"
- minSdkVersion 11
+ minSdkVersion 18
targetSdkVersion 23
+ versionCode 4
+ versionName "1.3"
+ testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
- compile 'com.android.support:support-v4:23.2.0'
+ compile 'com.android.support:support-v4:23.3.0'
+
+ testCompile 'junit:junit:4.12'
+ testCompile 'org.mockito:mockito-core:1.10.19'
+
+ androidTestCompile 'com.android.support:support-annotations:23.3.0'
+ androidTestCompile 'com.android.support.test:runner:0.4.1'
+ androidTestCompile 'com.android.support.test:rules:0.4.1'
+ androidTestCompile 'org.hamcrest:hamcrest-library:1.3'
+ androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
+ androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.1'
}
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..94d7c63
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in /Users/alex/Library/Developer/Xamarin/android-sdk-macosx/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
diff --git a/app/src/androidTest/java/org/hitlabnz/sensor_fusion_demo/androidTest/ApplicationTest.java b/app/src/androidTest/java/org/hitlabnz/sensor_fusion_demo/androidTest/ApplicationTest.java
new file mode 100644
index 0000000..35dcd4a
--- /dev/null
+++ b/app/src/androidTest/java/org/hitlabnz/sensor_fusion_demo/androidTest/ApplicationTest.java
@@ -0,0 +1,66 @@
+package org.hitlabnz.sensor_fusion_demo.androidTest;
+
+import android.app.Application;
+import android.support.test.espresso.matcher.ViewMatchers;
+import android.support.test.rule.ActivityTestRule;
+import android.support.test.runner.AndroidJUnit4;
+import android.test.ApplicationTestCase;
+import android.test.suitebuilder.annotation.LargeTest;
+
+import org.hitlabnz.sensor_fusion_demo.R;
+import org.hitlabnz.sensor_fusion_demo.SensorSelectionActivity;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static android.support.test.espresso.Espresso.onView;
+import static android.support.test.espresso.action.ViewActions.click;
+import static android.support.test.espresso.assertion.ViewAssertions.matches;
+import static android.support.test.espresso.matcher.ViewMatchers.hasLinks;
+import static android.support.test.espresso.matcher.ViewMatchers.withId;
+import static android.support.test.espresso.matcher.ViewMatchers.withText;
+
+///**
+// * Testing Fundamentals
+// */
+//public class ApplicationTest extends ApplicationTestCase {
+// public ApplicationTest() {
+// super(Application.class);
+// }
+//}
+
+@RunWith(AndroidJUnit4.class)
+@LargeTest
+public class ApplicationTest {
+
+ @Rule
+ public ActivityTestRule mActivityRule = new ActivityTestRule<>(
+ SensorSelectionActivity.class);
+
+ @Test
+ public void checkAssertMenuExists(){
+ DiscardGyroscopeWarning();
+
+ // Act & Assert
+ AssertThatAboutActionMenuExists();
+ }
+
+ @Test
+ public void clickAboutMenu_expectAboutToBeDisplayed(){
+ DiscardGyroscopeWarning();
+
+ // Act
+ onView(withId(R.id.action_about)).perform(click());
+
+ onView(withId(R.id.webViewAbout)).check(matches(ViewMatchers.isDisplayed()));
+ }
+
+
+ public void AssertThatAboutActionMenuExists() {
+ onView(withId(R.id.action_about)).check(matches(withText("About")));
+ }
+
+ public static void DiscardGyroscopeWarning() {
+ onView(withText("OK")).perform(click());
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 712f134..1e757ff 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -1,12 +1,6 @@
-
-
+ package="org.hitlabnz.sensor_fusion_demo" >
-
diff --git a/app/src/test/java/org/hitlabnz/sensor_fusion_demo/test/QuaternionTest.java b/app/src/test/java/org/hitlabnz/sensor_fusion_demo/test/QuaternionTest.java
new file mode 100644
index 0000000..240158f
--- /dev/null
+++ b/app/src/test/java/org/hitlabnz/sensor_fusion_demo/test/QuaternionTest.java
@@ -0,0 +1,30 @@
+package org.hitlabnz.sensor_fusion_demo.test;
+
+import org.hitlabnz.sensor_fusion_demo.representation.Quaternion;
+import org.junit.Test;
+
+import static org.hamcrest.CoreMatchers.*;
+import static org.junit.Assert.*;
+
+/**
+ * To work on unit tests, switch the Test Artifact in the Build Variants view.
+ */
+public class QuaternionTest {
+
+ @Test
+ public void quaternion_loadUnityQuaternion_expectCorrectValues() throws Exception {
+
+ // Arrange
+ Quaternion q = new Quaternion();
+
+ // Act
+ q.loadIdentityQuat();
+
+ // Assert
+ assertThat(q.w(), is(equalTo(1.0f)));
+ assertThat(q.x(), is(equalTo(0.0f)));
+ assertThat(q.y(), is(equalTo(0.0f)));
+ assertThat(q.z(), is(equalTo(0.0f)));
+ }
+}
+
diff --git a/build.gradle b/build.gradle
index 856d3d7..6559b3b 100644
--- a/build.gradle
+++ b/build.gradle
@@ -2,6 +2,7 @@
buildscript {
repositories {
jcenter()
+ maven { url 'http://repo1.maven.org/maven2' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
@@ -11,5 +12,10 @@ buildscript {
allprojects {
repositories {
jcenter()
+ maven { url 'http://repo1.maven.org/maven2' }
}
}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}