Test modules

This commit is contained in:
serso 2015-01-21 14:44:05 +01:00
parent fddb0dedf4
commit 35ee73b84b
41 changed files with 534 additions and 251 deletions

3
.gitignore vendored
View File

@ -4,4 +4,5 @@ atlassian-ide-plugin.xml
.idea/workspace.xml
.idea/tasks.xml
.idea/uiDesigner.xml
.idea/libraries/
.idea/libraries/
**/build

View File

@ -1,4 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false">
<file url="file://$PROJECT_DIR$/android-app-core-tests/build.gradle" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/android-app-tests/build.gradle" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/android-app-tests/src/test/java/org/solovyev/android/CalculatorTestRunner.java" charset="UTF-8" />
</component>
</project>

View File

@ -12,7 +12,9 @@
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/android-app" />
<option value="$PROJECT_DIR$/android-app-core" />
<option value="$PROJECT_DIR$/android-app-core-tests" />
<option value="$PROJECT_DIR$/android-app-onscreen" />
<option value="$PROJECT_DIR$/android-app-tests" />
<option value="$PROJECT_DIR$/android-app-widget" />
<option value="$PROJECT_DIR$/core" />
</set>

View File

@ -4,7 +4,9 @@
<modules>
<module fileurl="file://$PROJECT_DIR$/android-app/android-app.iml" filepath="$PROJECT_DIR$/android-app/android-app.iml" />
<module fileurl="file://$PROJECT_DIR$/android-app-core/android-app-core.iml" filepath="$PROJECT_DIR$/android-app-core/android-app-core.iml" />
<module fileurl="file://$PROJECT_DIR$/android-app-core-tests/android-app-core-tests.iml" filepath="$PROJECT_DIR$/android-app-core-tests/android-app-core-tests.iml" />
<module fileurl="file://$PROJECT_DIR$/android-app-onscreen/android-app-onscreen.iml" filepath="$PROJECT_DIR$/android-app-onscreen/android-app-onscreen.iml" />
<module fileurl="file://$PROJECT_DIR$/android-app-tests/android-app-tests.iml" filepath="$PROJECT_DIR$/android-app-tests/android-app-tests.iml" />
<module fileurl="file://$PROJECT_DIR$/android-app-widget/android-app-widget.iml" filepath="$PROJECT_DIR$/android-app-widget/android-app-widget.iml" />
<module fileurl="file://$PROJECT_DIR$/calculatorpp.iml" filepath="$PROJECT_DIR$/calculatorpp.iml" />
<module fileurl="file://$PROJECT_DIR$/core/core.iml" filepath="$PROJECT_DIR$/core/core.iml" />

View File

@ -0,0 +1,112 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":android-app-core-tests" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="calculatorpp" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":android-app-core-tests" />
</configuration>
</facet>
<facet type="java-gradle" name="Java-Gradle">
<configuration>
<option name="BUILD_FOLDER_PATH" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/classes/main" />
<output-test url="file://$MODULE_DIR$/build/classes/test" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
<excludeFolder url="file://$MODULE_DIR$/build" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="android-app" exported="" />
<orderEntry type="library" exported="" scope="TEST" name="junit-4.12" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="robolectric-2.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="mockito-all-1.9.5" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="jsonassert-1.2.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="hamcrest-core-1.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="objenesis-1.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="sqlite4java-0.282" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="asm-5.0.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="asm-commons-5.0.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="asm-util-5.0.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="asm-analysis-5.0.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="commons-logging-1.1.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="commons-codec-1.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="httpclient-4.0.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="vtd-xml-2.11" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="support-v4-19.0.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="fest-util-1.2.5" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="fest-reflect-1.4.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="maven-ant-tasks-2.1.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="json-20090211" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="asm-tree-5.0.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="httpcore-4.0.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="ant-1.8.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classworlds-1.1-alpha-2" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="plexus-container-default-1.0-alpha-9-stable-1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="plexus-utils-1.5.15" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="plexus-interpolation-1.11" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="maven-artifact-2.2.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="maven-artifact-manager-2.2.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="maven-model-2.2.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="maven-project-2.2.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="maven-error-diagnostics-2.2.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="maven-settings-2.2.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="wagon-file-1.0-beta-6" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="wagon-http-lightweight-1.0-beta-6" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="wagon-provider-api-1.0-beta-6" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="ant-launcher-1.8.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="maven-repository-metadata-2.2.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="backport-util-concurrent-3.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="maven-profile-2.2.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="maven-plugin-registry-2.2.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="wagon-http-shared-1.0-beta-6" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="xercesMinimal-1.9.6.2" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="nekohtml-1.9.6.2" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="simple-xml-2.6.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="core" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="commons-cli-1.2" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="annotations-2.0.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="stax-1.2.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="support-annotations-21.0.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="common-msg-1.0.5" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="common-listeners-1.0.7" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="guava-11.0.2" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="admob-6.4.1-r11.0.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="common-text-1.0.7" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="acra-4.5.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="internal_impl-21.0.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="common-core-1.0.7" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="jscl-1.0.8" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="common-security-1.0.7" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_android_app_build_intermediates_classes_debug" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_android_app_build_intermediates_dependency_cache_debug" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="android" level="project" />
</component>
</module>

View File

@ -0,0 +1,49 @@
/*
* Copyright 2014 serso aka se.solovyev
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Contact details
*
* Email: se.solovyev@gmail.com
* Site: http://se.solovyev.org
*/
apply plugin: 'java'
dependencies {
def androidModule = project(':android-app')
compile androidModule
testCompile androidModule.android.applicationVariants.toList().first().javaCompile.classpath
testCompile androidModule.android.applicationVariants.toList().first().javaCompile.outputs.files
testCompile files(androidModule.plugins.findPlugin("com.android.application").getBootClasspath())
testCompile 'junit:junit:4.+'
testCompile 'org.robolectric:robolectric:2.3'
testCompile "org.mockito:mockito-all:1.9.5"
testCompile "org.skyscreamer:jsonassert:1.2.3"
}
tasks.withType(Test) {
scanForTestClasses = false
include "**/*Test.class"
exclude "**/*AngleUnitsButtonTest*"
exclude "**/*NumeralBasesButtonTest*"
}
test {
maxParallelForks = 15
forkEvery = 1
}

View File

@ -4,9 +4,6 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import javax.annotation.Nonnull;
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
import org.junit.Before;
@ -16,15 +13,15 @@ import org.mockito.Mockito;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import javax.annotation.Nonnull;
import static org.mockito.Matchers.argThat;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.robolectric.Robolectric.application;
import static org.solovyev.android.calculator.CalculatorBroadcaster.ACTION_DISPLAY_STATE_CHANGED;
import static org.solovyev.android.calculator.CalculatorBroadcaster.ACTION_EDITOR_STATE_CHANGED;
import static org.solovyev.android.calculator.CalculatorEventType.display_state_changed;
import static org.solovyev.android.calculator.CalculatorEventType.editor_state_changed;
import static org.solovyev.android.calculator.CalculatorEventType.editor_state_changed_light;
import static org.solovyev.android.calculator.CalculatorEventType.*;
@Config(manifest = Config.NONE)
@RunWith(RobolectricTestRunner.class)

View File

@ -1,22 +1,16 @@
package org.solovyev.android.calculator;
import android.content.Intent;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.*;
import static org.robolectric.Robolectric.application;
import static org.solovyev.android.calculator.CalculatorButton.four;
import static org.solovyev.android.calculator.CalculatorReceiver.ACTION_BUTTON_ID_EXTRA;
import static org.solovyev.android.calculator.CalculatorReceiver.ACTION_BUTTON_PRESSED;
import static org.solovyev.android.calculator.CalculatorReceiver.newButtonClickedIntent;
import static org.solovyev.android.calculator.CalculatorReceiver.*;
@Config(manifest = Config.NONE)
@RunWith(RobolectricTestRunner.class)

View File

@ -24,14 +24,13 @@ package org.solovyev.android.calculator;
import android.content.Context;
import jscl.JsclMathEngine;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.mockito.Mockito;
import org.solovyev.android.calculator.history.CalculatorHistory;
import org.solovyev.android.calculator.plot.CalculatorPlotter;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* User: serso
* Date: 10/7/12

View File

@ -1,11 +1,6 @@
package org.solovyev.android.calculator.view;
import android.app.Activity;
import jscl.AngleUnit;
import java.util.ArrayList;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -15,14 +10,10 @@ import org.robolectric.RobolectricTestRunner;
import org.robolectric.res.Attribute;
import org.robolectric.shadows.ShadowActivity;
import static jscl.AngleUnit.deg;
import static jscl.AngleUnit.grad;
import static jscl.AngleUnit.rad;
import static jscl.AngleUnit.turns;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import static jscl.AngleUnit.*;
import static org.junit.Assert.*;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.solovyev.android.calculator.CalculatorTestUtils.staticSetUp;

View File

@ -1,10 +1,6 @@
package org.solovyev.android.calculator.view;
import android.app.Activity;
import jscl.NumeralBase;
import java.util.ArrayList;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -14,16 +10,10 @@ import org.robolectric.RobolectricTestRunner;
import org.robolectric.res.Attribute;
import org.robolectric.shadows.ShadowActivity;
import static jscl.AngleUnit.deg;
import static jscl.AngleUnit.rad;
import static jscl.NumeralBase.bin;
import static jscl.NumeralBase.dec;
import static jscl.NumeralBase.hex;
import static jscl.NumeralBase.oct;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import static jscl.NumeralBase.*;
import static org.junit.Assert.*;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.solovyev.android.calculator.CalculatorTestUtils.staticSetUp;

View File

@ -86,6 +86,7 @@
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="android-common-app-1.1.18" level="project" />
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
<orderEntry type="library" exported="" name="common-security-1.0.7" level="project" />
<orderEntry type="library" exported="" name="admob-6.4.1-r11.0.0" level="project" />
<orderEntry type="library" exported="" name="actionbarsherlock-4.4.0" level="project" />
<orderEntry type="library" exported="" name="android-common-core-1.1.18" level="project" />
@ -97,8 +98,8 @@
<orderEntry type="library" exported="" name="android-common-preferences-1.1.18" level="project" />
<orderEntry type="library" exported="" name="android-common-views-1.1.18" level="project" />
<orderEntry type="library" exported="" name="jscl-1.0.8" level="project" />
<orderEntry type="library" exported="" name="stax-1.2.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
<orderEntry type="library" exported="" name="stax-1.2.0" level="project" />
<orderEntry type="library" exported="" name="guava-11.0.2" level="project" />
<orderEntry type="library" exported="" name="commons-cli-1.2" level="project" />
<orderEntry type="library" exported="" name="simple-xml-2.6.1" level="project" />

View File

@ -34,12 +34,16 @@ android {
versionCode version_code()
versionName version_name()
}
lintOptions {
abortOnError false
}
}
dependencies {
compile project(':core')
compile 'org.solovyev:common-core:1.0.7'
compile 'org.solovyev:common-text:1.0.7'
compile 'org.solovyev:common-security:1.0.7'
compile 'org.solovyev.android:android-common-views:1.1.18@aar'
compile 'org.solovyev.android:android-common-menus:1.1.18@aar'
compile 'org.solovyev.android:android-common-core:1.1.18@aar'

View File

@ -86,6 +86,7 @@
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="android-common-app-1.1.18" level="project" />
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
<orderEntry type="library" exported="" name="common-security-1.0.7" level="project" />
<orderEntry type="library" exported="" name="admob-6.4.1-r11.0.0" level="project" />
<orderEntry type="library" exported="" name="actionbarsherlock-4.4.0" level="project" />
<orderEntry type="library" exported="" name="android-common-core-1.1.18" level="project" />
@ -97,8 +98,8 @@
<orderEntry type="library" exported="" name="android-common-preferences-1.1.18" level="project" />
<orderEntry type="library" exported="" name="android-common-views-1.1.18" level="project" />
<orderEntry type="library" exported="" name="jscl-1.0.8" level="project" />
<orderEntry type="library" exported="" name="stax-1.2.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
<orderEntry type="library" exported="" name="stax-1.2.0" level="project" />
<orderEntry type="library" exported="" name="guava-11.0.2" level="project" />
<orderEntry type="library" exported="" name="commons-cli-1.2" level="project" />
<orderEntry type="library" exported="" name="simple-xml-2.6.1" level="project" />

View File

@ -34,6 +34,9 @@ android {
versionCode version_code()
versionName version_name()
}
lintOptions {
abortOnError false
}
}
dependencies {

View File

@ -0,0 +1,112 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":android-app-tests" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="calculatorpp" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":android-app-tests" />
</configuration>
</facet>
<facet type="java-gradle" name="Java-Gradle">
<configuration>
<option name="BUILD_FOLDER_PATH" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/classes/main" />
<output-test url="file://$MODULE_DIR$/build/classes/test" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
<excludeFolder url="file://$MODULE_DIR$/build" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="android-app" exported="" />
<orderEntry type="library" exported="" scope="TEST" name="junit-4.11" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="robolectric-2.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="mockito-all-1.9.5" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="jsonassert-1.2.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="hamcrest-core-1.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="objenesis-1.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="sqlite4java-0.282" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="asm-5.0.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="asm-commons-5.0.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="asm-util-5.0.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="asm-analysis-5.0.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="commons-logging-1.1.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="commons-codec-1.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="httpclient-4.0.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="vtd-xml-2.11" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="support-v4-19.0.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="fest-util-1.2.5" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="fest-reflect-1.4.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="maven-ant-tasks-2.1.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="json-20090211" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="asm-tree-5.0.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="httpcore-4.0.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="ant-1.8.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classworlds-1.1-alpha-2" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="plexus-container-default-1.0-alpha-9-stable-1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="plexus-utils-1.5.15" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="plexus-interpolation-1.11" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="maven-artifact-2.2.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="maven-artifact-manager-2.2.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="maven-model-2.2.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="maven-project-2.2.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="maven-error-diagnostics-2.2.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="maven-settings-2.2.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="wagon-file-1.0-beta-6" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="wagon-http-lightweight-1.0-beta-6" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="wagon-provider-api-1.0-beta-6" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="ant-launcher-1.8.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="maven-repository-metadata-2.2.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="backport-util-concurrent-3.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="maven-profile-2.2.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="maven-plugin-registry-2.2.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="wagon-http-shared-1.0-beta-6" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="xercesMinimal-1.9.6.2" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="nekohtml-1.9.6.2" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="simple-xml-2.6.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="core" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="commons-cli-1.2" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="annotations-2.0.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="stax-1.2.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="support-annotations-21.0.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="common-msg-1.0.5" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="common-listeners-1.0.7" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="guava-11.0.2" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="admob-6.4.1-r11.0.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="common-text-1.0.7" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="acra-4.5.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="internal_impl-21.0.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="common-core-1.0.7" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="jscl-1.0.8" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="common-security-1.0.7" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_android_app_build_intermediates_classes_debug" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_android_app_build_intermediates_dependency_cache_debug" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="android" level="project" />
</component>
</module>

View File

@ -0,0 +1,52 @@
/*
* Copyright 2014 serso aka se.solovyev
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Contact details
*
* Email: se.solovyev@gmail.com
* Site: http://se.solovyev.org
*/
apply plugin: 'java'
dependencies {
def androidModule = project(':android-app')
compile androidModule
testCompile androidModule.android.applicationVariants.toList().first().javaCompile.classpath
testCompile androidModule.android.applicationVariants.toList().first().javaCompile.outputs.files
testCompile files(androidModule.plugins.findPlugin("com.android.application").getBootClasspath())
testCompile 'junit:junit:4.11'
testCompile 'org.robolectric:robolectric:2.3'
testCompile "org.mockito:mockito-all:1.9.5"
testCompile "org.skyscreamer:jsonassert:1.2.3"
}
tasks.withType(Test) {
scanForTestClasses = false
include "**/*Test.class"
exclude "**/*AndroidCalculatorEditorViewTest*"
exclude "**/*CalculatorWizardActivityTest*"
exclude "**/*OnScreenCalculatorWizardStepTest*"
exclude "**/*CalculatorWizardTest*"
exclude "**/*WizardStepTest*"
}
test {
maxParallelForks = 15
forkEvery = 1
}

View File

@ -1,97 +1,97 @@
/*
* Copyright 2013 serso aka se.solovyev
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Contact details
*
* Email: se.solovyev@gmail.com
* Site: http://se.solovyev.org
*/
package org.solovyev.android;
import org.junit.Assert;
import org.junit.Test;
import org.solovyev.android.calculator.units.CalculatorNumeralBase;
import org.solovyev.common.units.Unit;
import org.solovyev.common.units.UnitConverter;
import javax.annotation.Nonnull;
import java.util.Date;
import java.util.Random;
import static org.junit.Assert.assertTrue;
/**
* User: serso
* Date: 4/21/12
* Time: 8:24 PM
*/
public class AndroidNumeralBaseTest {
@Nonnull
private final UnitConverter<String> c = CalculatorNumeralBase.getConverter();
@Test
public void testIsSupported() throws Exception {
assertTrue(c.isSupported(CalculatorNumeralBase.bin, CalculatorNumeralBase.dec));
}
@Test
public void testConvertFromDec() throws Exception {
Assert.assertEquals("101", c.convert(CalculatorNumeralBase.dec.createUnit("5"), CalculatorNumeralBase.bin).getValue());
Assert.assertEquals("1", c.convert(CalculatorNumeralBase.dec.createUnit("1"), CalculatorNumeralBase.bin).getValue());
Assert.assertEquals("0", c.convert(CalculatorNumeralBase.dec.createUnit("0"), CalculatorNumeralBase.bin).getValue());
Assert.assertEquals("1111100111", c.convert(CalculatorNumeralBase.dec.createUnit("999"), CalculatorNumeralBase.bin).getValue());
Assert.assertEquals("A23", c.convert(CalculatorNumeralBase.dec.createUnit("2595"), CalculatorNumeralBase.hex).getValue());
Assert.assertEquals("AEE", c.convert(CalculatorNumeralBase.dec.createUnit("2798"), CalculatorNumeralBase.hex).getValue());
Assert.assertEquals("15", c.convert(CalculatorNumeralBase.dec.createUnit("21"), CalculatorNumeralBase.hex).getValue());
Assert.assertEquals("0", c.convert(CalculatorNumeralBase.dec.createUnit("0"), CalculatorNumeralBase.hex).getValue());
Assert.assertEquals("3E7", c.convert(CalculatorNumeralBase.dec.createUnit("999"), CalculatorNumeralBase.hex).getValue());
Assert.assertEquals("76", c.convert(CalculatorNumeralBase.dec.createUnit("62"), CalculatorNumeralBase.oct).getValue());
Assert.assertEquals("12", c.convert(CalculatorNumeralBase.dec.createUnit("10"), CalculatorNumeralBase.oct).getValue());
Assert.assertEquals("15", c.convert(CalculatorNumeralBase.dec.createUnit("13"), CalculatorNumeralBase.oct).getValue());
Assert.assertEquals("0", c.convert(CalculatorNumeralBase.dec.createUnit("0"), CalculatorNumeralBase.oct).getValue());
Assert.assertEquals("10445", c.convert(CalculatorNumeralBase.dec.createUnit("4389"), CalculatorNumeralBase.oct).getValue());
}
@Test
public void testRandomConvert() throws Exception {
final Random random = new Random(new Date().getTime());
for (int i = 0; i < 100000; i++) {
final String value = String.valueOf(random.nextInt());
Assert.assertEquals(value, convertChain(value, CalculatorNumeralBase.dec, CalculatorNumeralBase.oct, CalculatorNumeralBase.oct, CalculatorNumeralBase.bin, CalculatorNumeralBase.dec));
Assert.assertEquals(value, convertChain(value, CalculatorNumeralBase.dec, CalculatorNumeralBase.bin, CalculatorNumeralBase.hex, CalculatorNumeralBase.dec, CalculatorNumeralBase.dec));
Assert.assertEquals(value, convertChain(value, CalculatorNumeralBase.dec, CalculatorNumeralBase.dec, CalculatorNumeralBase.hex, CalculatorNumeralBase.oct, CalculatorNumeralBase.dec));
Assert.assertEquals(value, convertChain(value, CalculatorNumeralBase.dec, CalculatorNumeralBase.hex, CalculatorNumeralBase.bin, CalculatorNumeralBase.oct, CalculatorNumeralBase.dec));
}
}
@Nonnull
private String convertChain(@Nonnull String value, @Nonnull CalculatorNumeralBase baseAndroid, @Nonnull CalculatorNumeralBase... typeAndroids) {
Unit<String> unit = baseAndroid.createUnit(value);
for (CalculatorNumeralBase typeAndroid : typeAndroids) {
unit = CalculatorNumeralBase.getConverter().convert(unit, typeAndroid);
}
return unit.getValue();
}
}
/*
* Copyright 2013 serso aka se.solovyev
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Contact details
*
* Email: se.solovyev@gmail.com
* Site: http://se.solovyev.org
*/
package org.solovyev.android;
import org.junit.Assert;
import org.junit.Test;
import org.solovyev.android.calculator.units.CalculatorNumeralBase;
import org.solovyev.common.units.Unit;
import org.solovyev.common.units.UnitConverter;
import javax.annotation.Nonnull;
import java.util.Date;
import java.util.Random;
import static org.junit.Assert.assertTrue;
/**
* User: serso
* Date: 4/21/12
* Time: 8:24 PM
*/
public class AndroidNumeralBaseTest {
@Nonnull
private final UnitConverter<String> c = CalculatorNumeralBase.getConverter();
@Test
public void testIsSupported() throws Exception {
assertTrue(c.isSupported(CalculatorNumeralBase.bin, CalculatorNumeralBase.dec));
}
@Test
public void testConvertFromDec() throws Exception {
Assert.assertEquals("101", c.convert(CalculatorNumeralBase.dec.createUnit("5"), CalculatorNumeralBase.bin).getValue());
Assert.assertEquals("1", c.convert(CalculatorNumeralBase.dec.createUnit("1"), CalculatorNumeralBase.bin).getValue());
Assert.assertEquals("0", c.convert(CalculatorNumeralBase.dec.createUnit("0"), CalculatorNumeralBase.bin).getValue());
Assert.assertEquals("1111100111", c.convert(CalculatorNumeralBase.dec.createUnit("999"), CalculatorNumeralBase.bin).getValue());
Assert.assertEquals("A23", c.convert(CalculatorNumeralBase.dec.createUnit("2595"), CalculatorNumeralBase.hex).getValue());
Assert.assertEquals("AEE", c.convert(CalculatorNumeralBase.dec.createUnit("2798"), CalculatorNumeralBase.hex).getValue());
Assert.assertEquals("15", c.convert(CalculatorNumeralBase.dec.createUnit("21"), CalculatorNumeralBase.hex).getValue());
Assert.assertEquals("0", c.convert(CalculatorNumeralBase.dec.createUnit("0"), CalculatorNumeralBase.hex).getValue());
Assert.assertEquals("3E7", c.convert(CalculatorNumeralBase.dec.createUnit("999"), CalculatorNumeralBase.hex).getValue());
Assert.assertEquals("76", c.convert(CalculatorNumeralBase.dec.createUnit("62"), CalculatorNumeralBase.oct).getValue());
Assert.assertEquals("12", c.convert(CalculatorNumeralBase.dec.createUnit("10"), CalculatorNumeralBase.oct).getValue());
Assert.assertEquals("15", c.convert(CalculatorNumeralBase.dec.createUnit("13"), CalculatorNumeralBase.oct).getValue());
Assert.assertEquals("0", c.convert(CalculatorNumeralBase.dec.createUnit("0"), CalculatorNumeralBase.oct).getValue());
Assert.assertEquals("10445", c.convert(CalculatorNumeralBase.dec.createUnit("4389"), CalculatorNumeralBase.oct).getValue());
}
@Test
public void testRandomConvert() throws Exception {
final Random random = new Random(new Date().getTime());
for (int i = 0; i < 100000; i++) {
final String value = String.valueOf(random.nextInt());
Assert.assertEquals(value, convertChain(value, CalculatorNumeralBase.dec, CalculatorNumeralBase.oct, CalculatorNumeralBase.oct, CalculatorNumeralBase.bin, CalculatorNumeralBase.dec));
Assert.assertEquals(value, convertChain(value, CalculatorNumeralBase.dec, CalculatorNumeralBase.bin, CalculatorNumeralBase.hex, CalculatorNumeralBase.dec, CalculatorNumeralBase.dec));
Assert.assertEquals(value, convertChain(value, CalculatorNumeralBase.dec, CalculatorNumeralBase.dec, CalculatorNumeralBase.hex, CalculatorNumeralBase.oct, CalculatorNumeralBase.dec));
Assert.assertEquals(value, convertChain(value, CalculatorNumeralBase.dec, CalculatorNumeralBase.hex, CalculatorNumeralBase.bin, CalculatorNumeralBase.oct, CalculatorNumeralBase.dec));
}
}
@Nonnull
private String convertChain(@Nonnull String value, @Nonnull CalculatorNumeralBase baseAndroid, @Nonnull CalculatorNumeralBase... typeAndroids) {
Unit<String> unit = baseAndroid.createUnit(value);
for (CalculatorNumeralBase typeAndroid : typeAndroids) {
unit = CalculatorNumeralBase.getConverter().convert(unit, typeAndroid);
}
return unit.getValue();
}
}

View File

@ -0,0 +1,27 @@
package org.solovyev.android;
import org.junit.runners.model.InitializationError;
import org.robolectric.AndroidManifest;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import org.robolectric.res.Fs;
public class CalculatorTestRunner extends RobolectricTestRunner {
private static final int MAX_SDK_SUPPORTED_BY_ROBOLECTRIC = 18;
public CalculatorTestRunner(Class<?> testClass) throws InitializationError {
super(testClass);
}
@Override
protected AndroidManifest getAppManifest(Config config) {
final String manifestFilePath = "../android-app/src/main/AndroidManifest.xml";
final String resourcesFilePath = "../android-app-core/src/main/res";
return new AndroidManifest(Fs.fileFromPath(manifestFilePath), Fs.fileFromPath(resourcesFilePath)) {
@Override
public int getTargetSdkVersion() {
return MAX_SDK_SUPPORTED_BY_ROBOLECTRIC;
}
};
}
}

View File

@ -22,26 +22,26 @@
package org.solovyev.android.calculator;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.solovyev.android.CalculatorTestRunner;
import org.solovyev.common.text.Strings;
import java.util.Date;
import java.util.Random;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.solovyev.common.text.Strings;
/**
* User: serso
* Date: 10/13/12
* Time: 1:11 PM
*/
@RunWith(value = RobolectricTestRunner.class)
@RunWith(value = CalculatorTestRunner.class)
public class AndroidCalculatorEditorViewTest {
@BeforeClass

View File

@ -22,11 +22,11 @@
package org.solovyev.android.calculator.plot;
import org.junit.Test;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
/**

View File

@ -26,33 +26,27 @@ import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.shadows.ShadowActivity;
import org.robolectric.util.ActivityController;
import org.solovyev.android.CalculatorTestRunner;
import org.solovyev.android.wizard.BaseWizardActivity;
import org.solovyev.android.wizard.Wizard;
import org.solovyev.android.wizard.WizardUi;
import org.solovyev.android.wizard.Wizards;
import javax.annotation.Nonnull;
import java.lang.reflect.Field;
import static android.view.View.GONE;
import static android.view.View.VISIBLE;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.*;
import static org.solovyev.android.calculator.wizard.CalculatorWizardStep.choose_mode;
@RunWith(value = RobolectricTestRunner.class)
@RunWith(value = CalculatorTestRunner.class)
public class CalculatorWizardActivityTest {
private ActivityController<CalculatorWizardActivity> controller;

View File

@ -4,7 +4,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricTestRunner;
import org.solovyev.android.CalculatorTestRunner;
import org.solovyev.android.wizard.Wizard;
import org.solovyev.android.wizard.WizardFlow;
import org.solovyev.android.wizard.Wizards;
@ -12,11 +12,9 @@ import org.solovyev.android.wizard.Wizards;
import javax.annotation.Nonnull;
import static org.junit.Assert.*;
import static org.solovyev.android.calculator.wizard.CalculatorWizardStep.choose_mode;
import static org.solovyev.android.calculator.wizard.CalculatorWizardStep.last;
import static org.solovyev.android.calculator.wizard.CalculatorWizardStep.welcome;
import static org.solovyev.android.calculator.wizard.CalculatorWizardStep.*;
@RunWith(value = RobolectricTestRunner.class)
@RunWith(value = CalculatorTestRunner.class)
public class CalculatorWizardTest {
@Nonnull

View File

@ -24,26 +24,22 @@ package org.solovyev.android.calculator.wizard;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import javax.annotation.Nonnull;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.util.ActivityController;
import org.solovyev.android.CalculatorTestRunner;
import org.solovyev.android.calculator.CalculatorPreferences;
import org.solovyev.android.wizard.BaseWizardActivity;
import org.solovyev.android.wizard.WizardUi;
import javax.annotation.Nonnull;
import java.lang.reflect.Field;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.*;
@RunWith(RobolectricTestRunner.class)
@RunWith(CalculatorTestRunner.class)
public class OnScreenCalculatorWizardStepTest {
@Nonnull

View File

@ -30,8 +30,8 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import org.solovyev.android.CalculatorTestRunner;
import org.solovyev.android.calculator.CalculatorPreferences;
import static org.junit.Assert.*;
@ -45,14 +45,12 @@ import static org.solovyev.android.calculator.wizard.CalculatorLayout.big_button
import static org.solovyev.android.calculator.wizard.CalculatorLayout.optimized;
import static org.solovyev.android.calculator.wizard.CalculatorMode.engineer;
import static org.solovyev.android.calculator.wizard.CalculatorMode.simple;
import static org.solovyev.android.calculator.wizard.CalculatorWizardStep.*;
import static org.solovyev.android.calculator.wizard.ChooseLayoutWizardStep.LAYOUT;
import static org.solovyev.android.calculator.wizard.ChooseModeWizardStep.MODE;
import static org.solovyev.android.calculator.wizard.OnScreenCalculatorWizardStep.ONSCREEN_CALCULATOR_ENABLED;
import static org.solovyev.android.calculator.wizard.CalculatorWizardStep.choose_layout;
import static org.solovyev.android.calculator.wizard.CalculatorWizardStep.choose_mode;
import static org.solovyev.android.calculator.wizard.CalculatorWizardStep.on_screen_calculator;
@RunWith(RobolectricTestRunner.class)
@RunWith(CalculatorTestRunner.class)
public class WizardStepTest {
private FragmentActivity activity;

View File

@ -86,6 +86,7 @@
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="android-common-app-1.1.18" level="project" />
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
<orderEntry type="library" exported="" name="common-security-1.0.7" level="project" />
<orderEntry type="library" exported="" name="admob-6.4.1-r11.0.0" level="project" />
<orderEntry type="library" exported="" name="actionbarsherlock-4.4.0" level="project" />
<orderEntry type="library" exported="" name="android-common-core-1.1.18" level="project" />
@ -97,8 +98,8 @@
<orderEntry type="library" exported="" name="android-common-preferences-1.1.18" level="project" />
<orderEntry type="library" exported="" name="android-common-views-1.1.18" level="project" />
<orderEntry type="library" exported="" name="jscl-1.0.8" level="project" />
<orderEntry type="library" exported="" name="stax-1.2.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
<orderEntry type="library" exported="" name="stax-1.2.0" level="project" />
<orderEntry type="library" exported="" name="guava-11.0.2" level="project" />
<orderEntry type="library" exported="" name="commons-cli-1.2" level="project" />
<orderEntry type="library" exported="" name="simple-xml-2.6.1" level="project" />

View File

@ -34,6 +34,9 @@ android {
versionCode version_code()
versionName version_name()
}
lintOptions {
abortOnError false
}
}
dependencies {

View File

@ -83,12 +83,14 @@
</content>
<orderEntry type="jdk" jdkName="Maven Android API 17 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="acra-4.3.0" level="project" />
<orderEntry type="library" exported="" name="android-common-db-1.1.18" level="project" />
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
<orderEntry type="library" exported="" name="common-security-1.0.7" level="project" />
<orderEntry type="library" exported="" name="admob-6.4.1-r11.0.0" level="project" />
<orderEntry type="library" exported="" name="acra-4.5.0" level="project" />
<orderEntry type="library" exported="" name="android-common-core-1.1.18" level="project" />
<orderEntry type="library" exported="" name="android-common-billing-1.1.18" level="project" />
<orderEntry type="library" exported="" name="android-common-security-1.1.18" level="project" />
<orderEntry type="library" exported="" name="annotations-2.0.1" level="project" />
<orderEntry type="library" exported="" name="android-common-other-1.1.18" level="project" />
<orderEntry type="library" exported="" name="android-common-wizard-1.1.18" level="project" />

View File

@ -40,12 +40,15 @@ android {
zipAlignEnabled true
}
}
lintOptions {
abortOnError false
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:21.0.3'
compile ('ch.acra:acra:4.3.0') {
compile ('ch.acra:acra:4.5.0') {
exclude group: 'org.json'
}
compile 'org.solovyev.android:android-common-ads:1.1.18@aar'
@ -56,6 +59,7 @@ dependencies {
compile 'org.solovyev.android:android-common-core:1.1.18@aar'
compile 'org.solovyev.android:android-common-other:1.1.18@aar'
compile 'org.solovyev.android:android-common-db:1.1.18@aar'
compile 'org.solovyev.android:android-common-security:1.1.18@aar'
compile project(':android-app-core')
compile project(':android-app-widget')
compile project(':android-app-onscreen')

View File

@ -62,6 +62,8 @@
-dontwarn jscl.mathml.**
-dontwarn com.google.common.collect.MinMaxPriorityQueue
-dontwarn com.google.ads.**
-dontwarn com.sun.org.apache.xerces.internal.impl.dv.util.Base64
-dontwarn com.actionbarsherlock.BuildConfig
-keep class org.simpleframework.xml.** { *; }
-keep class * implements org.solovyev.android.calculator.model.MathPersistenceEntity

View File

@ -139,7 +139,9 @@ public class CalculatorApplication extends android.app.Application implements Sh
public void onCreate() {
ACRA.init(this);
App.init(this);
if (!App.isInitialized()) {
App.init(this);
}
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
CalculatorPreferences.setDefaultValues(preferences);

View File

@ -26,16 +26,13 @@ import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.solovyev.android.calculator.Calculator;
import org.solovyev.android.calculator.CalculatorEventData;
import org.solovyev.android.calculator.CalculatorEventType;
import org.solovyev.android.calculator.R;
import org.solovyev.common.history.HistoryAction;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;
/**
@ -60,7 +57,7 @@ public class AndroidCalculatorHistory implements CalculatorHistory {
public void load() {
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
if (preferences != null) {
final String value = preferences.getString(context.getString(R.string.p_calc_history), null);
final String value = preferences.getString("org.solovyev.android.calculator.CalculatorModel_history", null);
if (value != null) {
calculatorHistory.fromXml(value);
}
@ -71,7 +68,7 @@ public class AndroidCalculatorHistory implements CalculatorHistory {
final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
final SharedPreferences.Editor editor = settings.edit();
editor.putString(context.getString(R.string.p_calc_history), calculatorHistory.toXml());
editor.putString("org.solovyev.android.calculator.CalculatorModel_history", calculatorHistory.toXml());
editor.commit();
}

View File

@ -1,47 +0,0 @@
/*
* Copyright 2013 serso aka se.solovyev
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Contact details
*
* Email: se.solovyev@gmail.com
* Site: http://se.solovyev.org
*/
package org.solovyev.android.calculator;
/**
* User: serso
* Date: 6/18/13
* Time: 8:45 PM
*/
public class TestCalculatorApplication extends CalculatorApplication {
private static volatile boolean initialized = false;
public TestCalculatorApplication() {
super(false);
}
@Override
public void onCreate() {
synchronized (TestCalculatorApplication.class) {
if (!initialized) {
super.onCreate();
initialized = true;
}
}
}
}

View File

@ -1,9 +0,0 @@
package org.solovyev.android.calculator.matrix;
/**
* User: serso
* Date: 7/11/13
* Time: 4:56 PM
*/
public class MatrixViewTest {
}

View File

@ -1 +1,2 @@
include ':core', ':android-app-core', ':android-app-widget', ':android-app-onscreen', ':android-app'
include ':android-app-core-tests', ':android-app-tests'