forked from organicmaps/organicmaps
[android] Deleted old files & projects.
This commit is contained in:
parent
2295214260
commit
07064d7ca2
42 changed files with 0 additions and 1470 deletions
|
@ -1,241 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mapswithme.maps.pro"
|
||||
android:installLocation="preferExternal"
|
||||
android:sharedUserId="com.mapswithme"
|
||||
android:sharedUserLabel="@string/shared_user_label"
|
||||
android:versionCode="300"
|
||||
android:versionName="3.0.0" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="7"
|
||||
android:targetSdkVersion="19" />
|
||||
|
||||
<uses-feature
|
||||
android:glEsVersion="0x00020000"
|
||||
android:required="true" />
|
||||
<uses-feature
|
||||
android:name="android.hardware.touchscreen"
|
||||
android:required="true" />
|
||||
<uses-feature
|
||||
android:name="android.hardware.wifi"
|
||||
android:required="false" />
|
||||
<uses-feature
|
||||
android:name="android.hardware.location"
|
||||
android:required="false" />
|
||||
<uses-feature
|
||||
android:name="android.hardware.location.network"
|
||||
android:required="false" />
|
||||
<uses-feature
|
||||
android:name="android.hardware.location.gps"
|
||||
android:required="false" />
|
||||
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
|
||||
<!-- Used by instrumentation tests only. Do not include in production apps unless necessary! -->
|
||||
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
|
||||
<supports-screens
|
||||
android:largeScreens="true"
|
||||
android:xlargeScreens="true" />
|
||||
|
||||
<application
|
||||
android:name="com.mapswithme.maps.MwmApplication"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/MwmTheme.Main" >
|
||||
<activity
|
||||
android:name="com.mapswithme.maps.DownloadResourcesActivity"
|
||||
android:configChanges="orientation|screenLayout|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:screenOrientation="behind"
|
||||
android:theme="@style/MwmTheme.NoActionBar" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
|
||||
<!-- standard "geo" scheme -->
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" >
|
||||
</action>
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data android:scheme="geo" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" >
|
||||
</action>
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data android:scheme="ge0" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" >
|
||||
</action>
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data
|
||||
android:host="ge0.me"
|
||||
android:scheme="http" />
|
||||
</intent-filter>
|
||||
|
||||
<!-- API CALL -->
|
||||
<intent-filter>
|
||||
<action android:name="com.mapswithme.maps.api.request" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
|
||||
<data
|
||||
android:host="*"
|
||||
android:mimeType="application/vnd.google-earth.kmz" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
|
||||
<data
|
||||
android:host="*"
|
||||
android:mimeType="application/vnd.google-earth.kml+xml" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
|
||||
<data
|
||||
android:host="*"
|
||||
android:pathPattern=".*\\.kmz"
|
||||
android:scheme="file" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
|
||||
<data
|
||||
android:host="*"
|
||||
android:pathPattern=".*\\.kml"
|
||||
android:scheme="file" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.mapswithme.maps.MwmActivity"
|
||||
android:configChanges="orientation|screenLayout|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="behind"
|
||||
android:theme="@style/MwmTheme.NoActionBar" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.mapswithme.maps.DownloadUI"
|
||||
android:configChanges="orientation|screenLayout|screenSize"
|
||||
android:label="@string/download_maps"
|
||||
android:noHistory="true"
|
||||
android:screenOrientation="behind" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.mapswithme.maps.search.SearchActivity"
|
||||
android:configChanges="orientation|screenLayout|screenSize"
|
||||
android:label="@string/search_map"
|
||||
android:noHistory="true"
|
||||
android:screenOrientation="behind"
|
||||
android:theme="@style/MwmTheme.Search"
|
||||
android:windowSoftInputMode="stateVisible|adjustResize" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.mapswithme.maps.settings.SettingsActivity"
|
||||
android:configChanges="orientation|screenLayout|screenSize"
|
||||
android:label="@string/settings_and_more"
|
||||
android:screenOrientation="behind" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.mapswithme.maps.settings.StoragePathActivity"
|
||||
android:configChanges="orientation|screenLayout|screenSize"
|
||||
android:label="@string/maps_storage"
|
||||
android:screenOrientation="behind" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.mapswithme.maps.bookmarks.ChooseBookmarkCategoryActivity"
|
||||
android:configChanges="orientation|screenLayout|screenSize"
|
||||
android:label="@string/bookmark_sets"
|
||||
android:screenOrientation="behind"
|
||||
android:theme="@style/MwmMain.Dialog.Light"
|
||||
android:windowSoftInputMode="stateUnspecified|adjustResize" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.mapswithme.maps.bookmarks.BookmarkCategoriesActivity"
|
||||
android:configChanges="orientation|screenLayout|screenSize"
|
||||
android:label="@string/bookmarks"
|
||||
android:screenOrientation="behind" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.mapswithme.maps.bookmarks.BookmarkListActivity"
|
||||
android:configChanges="orientation|screenLayout|screenSize"
|
||||
android:label="@string/bookmarks"
|
||||
android:screenOrientation="behind" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.mapswithme.maps.bookmarks.BookmarkActivity"
|
||||
android:configChanges="orientation|screenLayout|screenSize"
|
||||
android:label="@string/bookmarks"
|
||||
android:screenOrientation="behind" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.mapswithme.maps.MapObjectActivity"
|
||||
android:launchMode="singleTop"
|
||||
android:screenOrientation="behind" >
|
||||
</activity>
|
||||
|
||||
<receiver
|
||||
android:name="com.mapswithme.test.MonkeyEventsReceiver"
|
||||
android:exported="true" >
|
||||
<intent-filter>
|
||||
<action android:name="mwmtest" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver
|
||||
android:name="com.mapswithme.maps.background.ConnectivityChangedReceiver"
|
||||
android:enabled="true"
|
||||
android:exported="true" >
|
||||
<intent-filter>
|
||||
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<service
|
||||
android:name="com.mapswithme.maps.background.WorkerService"
|
||||
android:exported="false" >
|
||||
</service>
|
||||
|
||||
<!-- Mobile Apps Tracking -->
|
||||
<receiver
|
||||
android:name="com.mobileapptracker.Tracker"
|
||||
android:exported="true" >
|
||||
<intent-filter>
|
||||
<action android:name="com.android.vending.INSTALL_REFERRER" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
</application>
|
||||
|
||||
</manifest>
|
|
@ -1 +0,0 @@
|
|||
This project is outdated and should be either modified/updated or deleted.
|
|
@ -1,96 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="MapsWithMeTest" default="help">
|
||||
|
||||
<property name="mwm.tools.dir" value="../../tools"/>
|
||||
<property name="mwm.data.dir" value="../../../data"/>
|
||||
<property name="renderscript.opt.level" value="O0"/>
|
||||
|
||||
<!-- The local.properties file is created and updated by the 'android' tool.
|
||||
It contains the path to the SDK. It should *NOT* be checked into
|
||||
Version Control Systems. -->
|
||||
<property file="local.properties" />
|
||||
|
||||
<!-- The ant.properties file can be created by you. It is only edited by the
|
||||
'android' tool to add properties to it.
|
||||
This is the place to change some Ant specific build properties.
|
||||
Here are some properties you may want to change/update:
|
||||
|
||||
source.dir
|
||||
The name of the source directory. Default is 'src'.
|
||||
out.dir
|
||||
The name of the output directory. Default is 'bin'.
|
||||
|
||||
For other overridable properties, look at the beginning of the rules
|
||||
files in the SDK, at tools/ant/build.xml
|
||||
|
||||
Properties related to the SDK location or the project target should
|
||||
be updated using the 'android' tool with the 'update' action.
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems.
|
||||
|
||||
-->
|
||||
<property file="ant.properties" />
|
||||
|
||||
<!-- if sdk.dir was not set from one of the property file, then
|
||||
get it from the ANDROID_HOME env var.
|
||||
This must be done before we load project.properties since
|
||||
the proguard config can use sdk.dir -->
|
||||
<property environment="env" />
|
||||
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
|
||||
<isset property="env.ANDROID_HOME" />
|
||||
</condition>
|
||||
|
||||
<!-- The project.properties file is created and updated by the 'android'
|
||||
tool, as well as ADT.
|
||||
|
||||
This contains project specific properties such as project target, and library
|
||||
dependencies. Lower level build properties are stored in ant.properties
|
||||
(or in .classpath for Eclipse projects).
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems. -->
|
||||
<loadproperties srcFile="project.properties" />
|
||||
|
||||
<!-- quick check on sdk.dir -->
|
||||
<fail
|
||||
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
|
||||
unless="sdk.dir"
|
||||
/>
|
||||
|
||||
<!--
|
||||
Import per project custom build rules if present at the root of the project.
|
||||
This is the place to put custom intermediary targets such as:
|
||||
-pre-build
|
||||
-pre-compile
|
||||
-post-compile (This is typically used for code obfuscation.
|
||||
Compiled code location: ${out.classes.absolute.dir}
|
||||
If this is not done in place, override ${out.dex.input.absolute.dir})
|
||||
-post-package
|
||||
-post-build
|
||||
-pre-clean
|
||||
-->
|
||||
<import file="custom_rules.xml" optional="true" />
|
||||
|
||||
<!-- Import the actual build file.
|
||||
|
||||
To customize existing targets, there are two options:
|
||||
- Customize only one target:
|
||||
- copy/paste the target into this file, *before* the
|
||||
<import> task.
|
||||
- customize it to your needs.
|
||||
- Customize the whole content of build.xml
|
||||
- copy/paste the content of the rules files (minus the top node)
|
||||
into this file, replacing the <import> task.
|
||||
- customize to your needs.
|
||||
|
||||
***********************
|
||||
****** IMPORTANT ******
|
||||
***********************
|
||||
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
||||
in order to avoid having your file be overridden by tools such as "android update project"
|
||||
-->
|
||||
<!-- version-tag: 1 -->
|
||||
<import file="${sdk.dir}/tools/ant/build.xml" />
|
||||
|
||||
</project>
|
|
@ -1,67 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="MapsWithMe" default="help">
|
||||
|
||||
<target name="-set-production-mode" depends="android_rules.-set-mode-check">
|
||||
<property name="out.packaged.file" location="${out.absolute.dir}/${ant.project.name}-production-unsigned.apk" />
|
||||
<property name="out.final.file" location="${out.absolute.dir}/${ant.project.name}-production.apk" />
|
||||
<property name="build.is.mode.set" value="true" />
|
||||
|
||||
<!-- record the current build target -->
|
||||
<property name="build.target" value="production" />
|
||||
|
||||
<property name="build.is.instrumented" value="false" />
|
||||
|
||||
<!-- production mode is only valid if the manifest does not explicitly
|
||||
set debuggable to true. default is false. -->
|
||||
<xpath input="AndroidManifest.xml" expression="/manifest/application/@android:debuggable"
|
||||
output="build.is.packaging.debug" default="false"/>
|
||||
|
||||
<!-- signing mode: production -->
|
||||
<property name="build.is.signing.debug" value="false" />
|
||||
|
||||
<if condition="${build.is.packaging.debug}">
|
||||
<then>
|
||||
<echo>*************************************************</echo>
|
||||
<echo>**** Android Manifest has debuggable=true ****</echo>
|
||||
<echo>** Doing DEBUG packaging with PRODUCTION keys ***</echo>
|
||||
<echo>*************************************************</echo>
|
||||
</then>
|
||||
<else>
|
||||
<!-- property only set in release mode.
|
||||
Useful for if/unless attributes in target node
|
||||
when using Ant before 1.8 -->
|
||||
<property name="build.is.mode.release" value="true"/>
|
||||
</else>
|
||||
</if>
|
||||
</target>
|
||||
|
||||
<target name="production" depends="-set-production-mode, android_rules.-release-obfuscation-check, android_rules.-package, android_rules.-release-prompt-for-password, android_rules.-release-nosign"
|
||||
if="has.keystore" description="Production target - almost the same as release, but with real word config.">
|
||||
<!-- only create apk if *not* a library project -->
|
||||
<do-only-if-not-library elseText="Library project: do not create apk..." >
|
||||
<sequential>
|
||||
<property name="out.unaligned.file" location="${out.absolute.dir}/${ant.project.name}-production-unaligned.apk" />
|
||||
<!-- Signs the APK -->
|
||||
<echo>Signing final apk...</echo>
|
||||
<signjar
|
||||
jar="${out.packaged.file}"
|
||||
signedjar="${out.unaligned.file}"
|
||||
keystore="${key.store}"
|
||||
storepass="${key.store.password}"
|
||||
alias="${key.alias}"
|
||||
keypass="${key.alias.password}"
|
||||
verbose="${verbose}" />
|
||||
|
||||
<!-- Zip aligns the APK -->
|
||||
<zipalign-helper in.package="${out.unaligned.file}"
|
||||
out.package="${out.final.file}" />
|
||||
<echo>Release Package: ${out.final.file}</echo>
|
||||
</sequential>
|
||||
</do-only-if-not-library>
|
||||
<record-build-info />
|
||||
</target>
|
||||
|
||||
<import file="../common_custom_rules.xml"/>
|
||||
|
||||
</project>
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
# To enable ProGuard in your project, edit project.properties
|
||||
# to define the proguard.config property as described in that file.
|
||||
#
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in ${sdk.dir}/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the ProGuard
|
||||
# include property in project.properties.
|
||||
#
|
||||
# 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 *;
|
||||
#}
|
|
@ -1,15 +0,0 @@
|
|||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must be checked in Version Control Systems.
|
||||
#
|
||||
# To customize properties used by the Ant build system edit
|
||||
# "ant.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
#
|
||||
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
|
||||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
||||
|
||||
# Project target.
|
||||
target=android-19
|
||||
android.library.reference.1=..
|
Binary file not shown.
Before Width: | Height: | Size: 9.5 KiB |
Binary file not shown.
Before Width: | Height: | Size: 3.3 KiB |
Binary file not shown.
Before Width: | Height: | Size: 5 KiB |
Binary file not shown.
Before Width: | Height: | Size: 14 KiB |
|
@ -1,4 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="MWMMain.NoBar" parent="@android:style/Theme.Holo.Light.NoActionBar"/>
|
||||
</resources>
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<resources>
|
||||
<string name="app_name">Maps With Me Pro</string>
|
||||
<string name="flurry_app_key">***REMOVED***</string>
|
||||
</resources>
|
|
@ -1,5 +0,0 @@
|
|||
<resources>
|
||||
|
||||
<style name="AppTheme" parent="android:Theme.Light" />
|
||||
|
||||
</resources>
|
|
@ -1,223 +0,0 @@
|
|||
package com.mapswithme.test;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Handler;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mapswithme.maps.MwmActivity;
|
||||
import com.mapswithme.maps.MwmActivity.MapTask;
|
||||
import com.mapswithme.maps.search.SearchActivity;
|
||||
import com.mapswithme.maps.bookmarks.data.Bookmark;
|
||||
import com.mapswithme.maps.bookmarks.data.BookmarkCategory;
|
||||
import com.mapswithme.maps.bookmarks.data.BookmarkManager;
|
||||
import com.mapswithme.util.log.Logger;
|
||||
import com.mapswithme.util.log.SimpleLogger;
|
||||
|
||||
public class MonkeyEventsReceiver extends BroadcastReceiver
|
||||
{
|
||||
|
||||
|
||||
static Logger sLogger = SimpleLogger.get("MonkeyBusiness");
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent)
|
||||
{
|
||||
ExtractableMapTask mapTask = KEY_TO_TASK.get(intent.getStringExtra(EXTRA_TASK));
|
||||
if (mapTask != null)
|
||||
{
|
||||
mapTask = mapTask.extract(intent);
|
||||
sLogger.d(mapTask.toString());
|
||||
intent = new Intent(context, MwmActivity.class);
|
||||
intent.putExtra(MwmActivity.EXTRA_TASK, mapTask);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
else
|
||||
sLogger.d("No task found");
|
||||
}
|
||||
|
||||
|
||||
public interface ExtractableMapTask extends MapTask
|
||||
{
|
||||
public ExtractableMapTask extract(Intent intent);
|
||||
};
|
||||
|
||||
private static String EXTRA_TASK = "task";
|
||||
private static String TYPE_SEARCH = "task_search";
|
||||
private static String TYPE_BOOKMARK = "task_bmk";
|
||||
|
||||
private static final Map<String, ExtractableMapTask> KEY_TO_TASK = new HashMap<String, ExtractableMapTask>(4);
|
||||
|
||||
static
|
||||
{
|
||||
KEY_TO_TASK.put(TYPE_BOOKMARK, new ShowBookmarksTask());
|
||||
KEY_TO_TASK.put(TYPE_SEARCH, new SearchTask());
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public static class SearchTask implements ExtractableMapTask
|
||||
{
|
||||
String mQuery;
|
||||
int mScope;
|
||||
|
||||
@Override
|
||||
public boolean run(final MwmActivity target)
|
||||
{
|
||||
sLogger.d("Running me!", this, target);
|
||||
target.onMyPositionClicked(null);
|
||||
final Handler delayHandler = new Handler();
|
||||
|
||||
delayHandler.postDelayed(new Runnable()
|
||||
{
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
// TODO finish search task
|
||||
}
|
||||
}, 1500);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExtractableMapTask extract(Intent data)
|
||||
{
|
||||
final SearchTask task = new SearchTask();
|
||||
|
||||
task.mQuery = data.getStringExtra(SearchActivity.EXTRA_QUERY);
|
||||
sLogger.d("q: ", task.mQuery);
|
||||
|
||||
final String scopeStr = data.getStringExtra(SearchActivity.EXTRA_SCOPE);
|
||||
sLogger.d("s: ", scopeStr);
|
||||
if (scopeStr != null)
|
||||
task.mScope = Integer.parseInt(scopeStr);
|
||||
|
||||
return task;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "SearchTask [query=" + mQuery + ", scope=" + mScope + "]";
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public static class ShowBookmarksTask implements ExtractableMapTask
|
||||
{
|
||||
String mName;
|
||||
|
||||
@Override
|
||||
public boolean run(final MwmActivity target)
|
||||
{
|
||||
final int categoriesCount = BookmarkManager.INSTANCE.getCategoriesCount();
|
||||
|
||||
// find category
|
||||
BookmarkCategory categoryToShow = null;
|
||||
for (int i = 0; i < categoriesCount; i++)
|
||||
{
|
||||
categoryToShow = BookmarkManager.INSTANCE.getCategoryById(i);
|
||||
if (categoryToShow.getName().contains(mName))
|
||||
break;
|
||||
else
|
||||
categoryToShow = null;
|
||||
}
|
||||
|
||||
if (categoryToShow != null)
|
||||
{
|
||||
final int catToShowId = categoryToShow.getId();
|
||||
final Handler handler = new Handler();
|
||||
sLogger.d("Found category:", categoryToShow.getName());
|
||||
|
||||
class ShowBmkRunnable implements Runnable
|
||||
{
|
||||
MwmActivity mActivity;
|
||||
int mBmkId;
|
||||
int mCatId;
|
||||
int mMaxCount;
|
||||
|
||||
public ShowBmkRunnable(MwmActivity activity, int bmk, int cat, int count)
|
||||
{
|
||||
mActivity = activity;
|
||||
mBmkId = bmk;
|
||||
mCatId = cat;
|
||||
mMaxCount = count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
sLogger.d("Step!");
|
||||
// bring foreground
|
||||
mActivity.startActivity(new Intent(mActivity, MwmActivity.class));
|
||||
|
||||
final Bookmark bookmark = BookmarkManager.INSTANCE.getBookmark(mCatId, mBmkId);
|
||||
final BookmarkCategory category = BookmarkManager.INSTANCE.getCategoryById(mCatId);
|
||||
final String desc = bookmark.getBookmarkDescription();
|
||||
|
||||
// Center camera at bookmark
|
||||
BookmarkManager.INSTANCE.showBookmarkOnMap(mCatId, mBmkId);
|
||||
|
||||
// N2DP (Nataha to Dmitry Protocol)
|
||||
// Bookmark has no description: show map
|
||||
// Bookmark has '!' description: show balloon
|
||||
// Bookmark has '$' description: show place page
|
||||
// TODO: it is better to swap cases 1 and 3
|
||||
if (TextUtils.isEmpty(desc))
|
||||
{
|
||||
// if empty we hide group and ballon
|
||||
category.setVisibility(false);
|
||||
target.deactivatePopup();
|
||||
}
|
||||
else
|
||||
{
|
||||
category.setVisibility(true);
|
||||
final char code = desc.charAt(0);
|
||||
if (code == '!')
|
||||
{
|
||||
// just show pop up
|
||||
}
|
||||
else if (code == '$')
|
||||
{
|
||||
//show place page
|
||||
target.onBookmarkActivated(mCatId, mBmkId);
|
||||
}
|
||||
|
||||
}
|
||||
// do while have bookmarks to show
|
||||
if (mBmkId + 1 < mMaxCount)
|
||||
handler.postDelayed(new ShowBmkRunnable(mActivity, ++mBmkId, mCatId, mMaxCount), 4000);
|
||||
}
|
||||
}
|
||||
handler.postDelayed(new ShowBmkRunnable(target, 0, catToShowId, categoryToShow.getSize()), 0);
|
||||
}
|
||||
else
|
||||
sLogger.d("Cant find group name:", mName);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExtractableMapTask extract(Intent intent)
|
||||
{
|
||||
final ShowBookmarksTask task = new ShowBookmarksTask();
|
||||
task.mName = intent.getStringExtra("name");
|
||||
sLogger.d("Got", task);
|
||||
return task;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "ShowBookmarksTask [name=" + mName + "]";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- package name must be unique so suffix with "tests" so package loader doesn't ignore us -->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mapswithme.maps.pro.tests"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
<!-- We add an application tag here just so that we can indicate that
|
||||
this package needs to link against the android.test library,
|
||||
which is needed when building test cases. -->
|
||||
<application>
|
||||
<uses-library android:name="android.test.runner" />
|
||||
</application>
|
||||
<!--
|
||||
This declares that this application uses the instrumentation test runner targeting
|
||||
the package of com.mapswithme.maps.pro. To run the tests use the command:
|
||||
"adb shell am instrument -w com.mapswithme.maps.pro.tests/android.test.InstrumentationTestRunner"
|
||||
-->
|
||||
<instrumentation android:name="com.mapswithme.maps.tests.SpoonInstrumentationTestRunner"
|
||||
android:targetPackage="com.mapswithme.maps.pro"
|
||||
android:label="Tests for com.mapswithme.maps.pro"/>
|
||||
</manifest>
|
|
@ -1,12 +0,0 @@
|
|||
# How to run tests #
|
||||
Tests must be run from android root android directory:
|
||||
```bash
|
||||
cd somewhere_in_your_system/omim/android
|
||||
```
|
||||
Then just run run_spoon_tests.sh script:
|
||||
```bash
|
||||
./tests/run_spoon_tests.sh
|
||||
```
|
||||
Static html report will be placed in **spoon-output** folder.
|
||||
|
||||
*NOTE* project must be compiled with debug configuration before running test:`cd tests; ant debug`
|
|
@ -1,92 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="MapsWithMeProTests" default="help">
|
||||
|
||||
<!-- The local.properties file is created and updated by the 'android' tool.
|
||||
It contains the path to the SDK. It should *NOT* be checked into
|
||||
Version Control Systems. -->
|
||||
<property file="local.properties" />
|
||||
|
||||
<!-- The ant.properties file can be created by you. It is only edited by the
|
||||
'android' tool to add properties to it.
|
||||
This is the place to change some Ant specific build properties.
|
||||
Here are some properties you may want to change/update:
|
||||
|
||||
source.dir
|
||||
The name of the source directory. Default is 'src'.
|
||||
out.dir
|
||||
The name of the output directory. Default is 'bin'.
|
||||
|
||||
For other overridable properties, look at the beginning of the rules
|
||||
files in the SDK, at tools/ant/build.xml
|
||||
|
||||
Properties related to the SDK location or the project target should
|
||||
be updated using the 'android' tool with the 'update' action.
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems.
|
||||
|
||||
-->
|
||||
<property file="ant.properties" />
|
||||
|
||||
<!-- if sdk.dir was not set from one of the property file, then
|
||||
get it from the ANDROID_HOME env var.
|
||||
This must be done before we load project.properties since
|
||||
the proguard config can use sdk.dir -->
|
||||
<property environment="env" />
|
||||
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
|
||||
<isset property="env.ANDROID_HOME" />
|
||||
</condition>
|
||||
|
||||
<!-- The project.properties file is created and updated by the 'android'
|
||||
tool, as well as ADT.
|
||||
|
||||
This contains project specific properties such as project target, and library
|
||||
dependencies. Lower level build properties are stored in ant.properties
|
||||
(or in .classpath for Eclipse projects).
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems. -->
|
||||
<loadproperties srcFile="project.properties" />
|
||||
|
||||
<!-- quick check on sdk.dir -->
|
||||
<fail
|
||||
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
|
||||
unless="sdk.dir"
|
||||
/>
|
||||
|
||||
<!--
|
||||
Import per project custom build rules if present at the root of the project.
|
||||
This is the place to put custom intermediary targets such as:
|
||||
-pre-build
|
||||
-pre-compile
|
||||
-post-compile (This is typically used for code obfuscation.
|
||||
Compiled code location: ${out.classes.absolute.dir}
|
||||
If this is not done in place, override ${out.dex.input.absolute.dir})
|
||||
-post-package
|
||||
-post-build
|
||||
-pre-clean
|
||||
-->
|
||||
<import file="custom_rules.xml" optional="true" />
|
||||
|
||||
<!-- Import the actual build file.
|
||||
|
||||
To customize existing targets, there are two options:
|
||||
- Customize only one target:
|
||||
- copy/paste the target into this file, *before* the
|
||||
<import> task.
|
||||
- customize it to your needs.
|
||||
- Customize the whole content of build.xml
|
||||
- copy/paste the content of the rules files (minus the top node)
|
||||
into this file, replacing the <import> task.
|
||||
- customize to your needs.
|
||||
|
||||
***********************
|
||||
****** IMPORTANT ******
|
||||
***********************
|
||||
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
||||
in order to avoid having your file be overridden by tools such as "android update project"
|
||||
-->
|
||||
<!-- version-tag: 1 -->
|
||||
<import file="${sdk.dir}/tools/ant/build.xml" />
|
||||
|
||||
</project>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,77 +0,0 @@
|
|||
# coding=utf-8
|
||||
import time
|
||||
|
||||
from mutil import DeviceInfo
|
||||
from com.android.monkeyrunner import MonkeyRunner
|
||||
|
||||
apkPath = '../MapsWithMeTest/bin/MapsWithMeTest-release.apk'
|
||||
package = 'com.mapswithme.maps.pro'
|
||||
activity = 'com.mapswithme.maps.DownloadResourcesActivity'
|
||||
mapactivity = 'com.mapswithme.maps.MwmActivity'
|
||||
|
||||
|
||||
def run_tasks(device, tasks):
|
||||
# wait for initialization
|
||||
MonkeyRunner.sleep(5)
|
||||
for t in tasks:
|
||||
t.send(device)
|
||||
|
||||
|
||||
class MWMTask:
|
||||
def send(self, device):
|
||||
pass
|
||||
|
||||
|
||||
class SearchTask(MWMTask):
|
||||
task = 'task_search'
|
||||
query = ''
|
||||
scope = 0
|
||||
|
||||
def __init__(self, query, scope=0):
|
||||
self.query = query
|
||||
self.scope = scope
|
||||
|
||||
|
||||
def send(self, device):
|
||||
device.broadcastIntent(action='mwmtest',
|
||||
extras={'task': self.task, 'search_query': str(self.query),
|
||||
'search_scope': str(self.scope)})
|
||||
print 'Sent', self
|
||||
MonkeyRunner.sleep(3)
|
||||
di = DeviceInfo(device)
|
||||
device.takeSnapshot().writeToFile(di.get_screenshot_path(self))
|
||||
|
||||
|
||||
def __str__(self):
|
||||
return 'search_%s_%s' % (self.query, str(self.scope))
|
||||
|
||||
|
||||
class ShowGroupTask(MWMTask):
|
||||
task = 'task_bmk'
|
||||
name = ''
|
||||
duration = 0
|
||||
|
||||
def __init__(self, name, duration):
|
||||
self.name = name
|
||||
self.duration = duration
|
||||
|
||||
def send(self, device):
|
||||
di = DeviceInfo(device)
|
||||
# send intent
|
||||
device.broadcastIntent(action='mwmtest',
|
||||
extras={'task': self.task, 'name': self.name})
|
||||
|
||||
start = time.time()
|
||||
end = start + self.duration
|
||||
now = start
|
||||
print now, end, end - now
|
||||
while now < end:
|
||||
now = time.time()
|
||||
filename = di.get_screenshot_path('%s_%s' % (self, now))
|
||||
device.takeSnapshot().writeToFile(filename)
|
||||
print 'Captured', filename
|
||||
MonkeyRunner.sleep(0.7)
|
||||
|
||||
|
||||
def __str__(self):
|
||||
return 'group_show_%s_%s' % (self.name, str(self.duration))
|
|
@ -1,44 +0,0 @@
|
|||
#!/usr/bin/env monkeyrunner
|
||||
# coding=utf-8
|
||||
|
||||
import sys
|
||||
|
||||
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
|
||||
from mapswithme import *
|
||||
|
||||
enTask = [ShowGroupTask('Gr', 4 * 11), ShowGroupTask('Tha', 4 * 8)]
|
||||
|
||||
deTask = [ShowGroupTask('Ger', 4 * 11)]
|
||||
|
||||
ukTask = [ShowGroupTask('Uk', 4 * 9)]
|
||||
|
||||
spTask = [ShowGroupTask('Sp', 4 * 14)]
|
||||
|
||||
itTask = [ShowGroupTask('Italy', 4 * 10)]
|
||||
|
||||
|
||||
# This one to run
|
||||
sampleTasks = spTask
|
||||
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
id = sys.argv[1]
|
||||
print 'Connecting to device %s' % id
|
||||
device = MonkeyRunner.waitForConnection(5, id)
|
||||
else:
|
||||
print 'Connecting ...'
|
||||
device = MonkeyRunner.waitForConnection(timeout=5)
|
||||
|
||||
if not device:
|
||||
sys.exit("Could not connect to device")
|
||||
else:
|
||||
print 'Connected'
|
||||
|
||||
print 'Installing file %s' % apkPath
|
||||
|
||||
device.installPackage(apkPath)
|
||||
device.startActivity(package + '/' + activity)
|
||||
|
||||
device.wake()
|
||||
# mu.dumb_test(device, package)
|
||||
run_tasks(device, sampleTasks)
|
|
@ -1,88 +0,0 @@
|
|||
from random import randint
|
||||
import os
|
||||
|
||||
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
|
||||
|
||||
|
||||
# for notification bar
|
||||
defYoffset = 50
|
||||
|
||||
|
||||
class DeviceInfo:
|
||||
width = 0
|
||||
height = 0
|
||||
model = 'UnknownDevice'
|
||||
lang = 'NA'
|
||||
country = 'na'
|
||||
|
||||
def __init__(self, device):
|
||||
self.width = int(device.getProperty('display.width'))
|
||||
self.height = int(device.getProperty('display.height'))
|
||||
self.model = str(device.getProperty('build.model'))
|
||||
self.lang = str(device.shell('getprop persist.sys.language')).rstrip()
|
||||
self.country = str(device.shell('getprop persist.sys.country')).rstrip()
|
||||
|
||||
def dump(self):
|
||||
return '%s_%s_%s_%sx%sx' % (self.model, self.lang, self.country, self.height, self.width)
|
||||
|
||||
def get_screenshot_dir(self):
|
||||
dirname = self.dump()
|
||||
if not os.path.exists(dirname):
|
||||
os.makedirs(dirname)
|
||||
return dirname
|
||||
|
||||
def get_screenshot_path(self, tag):
|
||||
dirname = self.get_screenshot_dir()
|
||||
return '%s/screenshot-%s.png' % (dirname, tag)
|
||||
|
||||
|
||||
def is_still_running(device, package):
|
||||
curPack = str(device.getProperty('am.current.package'))
|
||||
print curPack
|
||||
return package == curPack
|
||||
|
||||
|
||||
def swipe(device, start, end):
|
||||
device.drag(start, end, 0.01, 100)
|
||||
|
||||
|
||||
def click(device, x, y):
|
||||
device.touch(x, y, 'DOWN_AND_UP')
|
||||
|
||||
|
||||
def randswipe(device, di=None, count=1):
|
||||
if not di:
|
||||
di = DeviceInfo(device)
|
||||
for x in range(0, count):
|
||||
start = (randint(0, di.width), randint(defYoffset, di.height))
|
||||
end = (randint(0, di.width), randint(defYoffset, di.height))
|
||||
print 's=%s e=%s' % (start, end)
|
||||
swipe(device, start, end)
|
||||
|
||||
|
||||
def randclick(device, di=None, count=1):
|
||||
if not di:
|
||||
di = DeviceInfo(device)
|
||||
for x in range(0, count):
|
||||
x = randint(0, di.width)
|
||||
y = randint(defYoffset, di.height)
|
||||
print 'x=%d y=%d' % (x, y)
|
||||
click(device, x, y)
|
||||
|
||||
|
||||
def dumb_test(device, package):
|
||||
di = DeviceInfo(device)
|
||||
print 'Starting test at %s' % di.dump()
|
||||
MonkeyRunner.sleep(10)
|
||||
testSteps = 100
|
||||
for i in range(0, testSteps):
|
||||
if is_still_running(device, package):
|
||||
# atack!
|
||||
randswipe(device, di)
|
||||
randclick(device, di, 3)
|
||||
# Give some time to render new tiles
|
||||
MonkeyRunner.sleep(0.5)
|
||||
device.takeSnapshot().writeToFile(di.get_screenshot_path(i))
|
||||
else:
|
||||
print 'Where is MapsWithMe?'
|
||||
print 'Done testing %s' % di.dump()
|
|
@ -1,20 +0,0 @@
|
|||
# To enable ProGuard in your project, edit project.properties
|
||||
# to define the proguard.config property as described in that file.
|
||||
#
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in ${sdk.dir}/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the ProGuard
|
||||
# include property in project.properties.
|
||||
#
|
||||
# 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 *;
|
||||
#}
|
|
@ -1,14 +0,0 @@
|
|||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must be checked in Version Control Systems.
|
||||
#
|
||||
# To customize properties used by the Ant build system edit
|
||||
# "ant.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
#
|
||||
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
|
||||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
||||
|
||||
# Project target.
|
||||
target=android-19
|
|
@ -1,17 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
APK=MapsWithMeTest/bin/MapsWithMeTest-debug.apk
|
||||
TEST_APK=tests/bin/MapsWithMeTests-debug.apk
|
||||
TEST_PROJ=tests
|
||||
SPOON_JAR=tests/tools/spoon-runner-1.0.5-jar-with-dependencies.jar
|
||||
|
||||
if [ ! -f $APK ]; then
|
||||
echo "File $APK not found, please run 'ant debug' from $TEST_PROJ "
|
||||
elif [ ! -f $TEST_APK ]; then
|
||||
echo "File $TEST_APK not found, please run 'ant debug' from $TEST_PROJ "
|
||||
else
|
||||
# normal execution
|
||||
java -jar $SPOON_JAR --apk $APK --test-apk $TEST_APK
|
||||
echo "Done testing"
|
||||
open spoon-output/index.html
|
||||
fi
|
|
@ -1,61 +0,0 @@
|
|||
package com.mapswithme.maps.tests;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import android.test.ActivityInstrumentationTestCase2;
|
||||
|
||||
import com.jayway.android.robotium.solo.Solo;
|
||||
import com.mapswithme.maps.DownloadUI;
|
||||
import com.mapswithme.maps.MwmActivity;
|
||||
import com.mapswithme.maps.R;
|
||||
import com.mapswithme.maps.search.SearchActivity;
|
||||
import com.mapswithme.maps.bookmarks.BookmarkCategoriesActivity;
|
||||
import com.squareup.spoon.Spoon;
|
||||
|
||||
public class MapActivityTest extends ActivityInstrumentationTestCase2<MwmActivity>
|
||||
{
|
||||
private static final int TIME_OUT = 5*1000;
|
||||
|
||||
public MapActivityTest()
|
||||
{
|
||||
super(MwmActivity.class);
|
||||
}
|
||||
|
||||
public void testAllButtons()
|
||||
{
|
||||
final MwmActivity activity = getActivity();
|
||||
final Solo solo = new Solo(getInstrumentation(), activity);
|
||||
|
||||
Spoon.screenshot(activity, "initial_state");
|
||||
// Click all button and count started activities
|
||||
solo.clickOnView(activity.findViewById(R.id.map_button_bookmarks));
|
||||
solo.waitForActivity(BookmarkCategoriesActivity.class, TIME_OUT);
|
||||
solo.getActivityMonitor().getLastActivity().finish();
|
||||
|
||||
solo.clickOnView(activity.findViewById(R.id.map_button_download));
|
||||
solo.waitForActivity(DownloadUI.class, TIME_OUT);
|
||||
solo.getActivityMonitor().getLastActivity().finish();
|
||||
|
||||
solo.clickOnView(activity.findViewById(R.id.map_button_search));
|
||||
solo.waitForActivity(SearchActivity.class, TIME_OUT);
|
||||
solo.getActivityMonitor().getLastActivity().finish();
|
||||
|
||||
solo.clickOnView(activity.findViewById(R.id.my_position));
|
||||
|
||||
// check zoom in/out doesn't crash us
|
||||
int randomNumderOfClicks = new Random().nextInt(10) + 5;
|
||||
for (int i = 0; i <= randomNumderOfClicks; i++)
|
||||
solo.clickOnView(activity.findViewById(R.id.map_button_plus));
|
||||
|
||||
randomNumderOfClicks = new Random().nextInt(10) + 5;
|
||||
for (int i = 0; i <= randomNumderOfClicks; i++)
|
||||
solo.clickOnView(activity.findViewById(R.id.map_button_minus));
|
||||
|
||||
|
||||
Spoon.screenshot(activity, "on_clicks_tested");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,83 +0,0 @@
|
|||
package com.mapswithme.maps.tests;
|
||||
|
||||
import static com.mapswithme.maps.MapObjectActivity.EXTRA_BMK_CAT;
|
||||
import static com.mapswithme.maps.MapObjectActivity.EXTRA_BMK_INDEX;
|
||||
import static com.mapswithme.maps.MapObjectActivity.EXTRA_OBJECT_TYPE;
|
||||
import static org.fest.assertions.api.ANDROID.assertThat;
|
||||
import android.content.Intent;
|
||||
import android.test.ActivityInstrumentationTestCase2;
|
||||
import android.util.Pair;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.jayway.android.robotium.solo.Solo;
|
||||
import com.mapswithme.maps.MapObjectActivity;
|
||||
import com.mapswithme.maps.MapObjectFragment;
|
||||
import com.mapswithme.maps.R;
|
||||
import com.mapswithme.maps.bookmarks.BookmarkActivity;
|
||||
import com.mapswithme.maps.bookmarks.data.BookmarkManager;
|
||||
import com.squareup.spoon.Spoon;
|
||||
|
||||
public class MapObjectActivityBMKTest extends ActivityInstrumentationTestCase2<MapObjectActivity>
|
||||
{
|
||||
|
||||
BookmarkManager bookmarkManager;
|
||||
|
||||
private final static String BMK_NAME = "Питер";
|
||||
private final static double BMK_LAT = 59.9393;
|
||||
private final static double BMK_LON = 30.3153;
|
||||
private Pair<Integer, Integer> catbmk;
|
||||
|
||||
public MapObjectActivityBMKTest()
|
||||
{
|
||||
super(MapObjectActivity.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
|
||||
bookmarkManager = BookmarkManager.INSTANCE;
|
||||
catbmk = bookmarkManager.addNewBookmark(BMK_NAME, BMK_LAT, BMK_LON);
|
||||
}
|
||||
|
||||
|
||||
public void testView_Bmk()
|
||||
{
|
||||
setActivityIntent(getBookmarkIntent());
|
||||
final MapObjectActivity activity = getActivity();
|
||||
final Solo solo = new Solo(getInstrumentation(), activity);
|
||||
|
||||
Spoon.screenshot(activity, "initial_state_bmk");
|
||||
|
||||
final TextView name = (TextView) activity.findViewById(R.id.name);
|
||||
assertThat(name).hasText(BMK_NAME);
|
||||
|
||||
final Button openWithBtn = (Button) activity.findViewById(R.id.openWith);
|
||||
assertThat(openWithBtn).isGone();
|
||||
|
||||
final Button addToBmksButton = (Button) activity.findViewById(R.id.addToBookmarks);
|
||||
assertThat(addToBmksButton).isGone();
|
||||
|
||||
final TextView coords = (TextView) activity.findViewById(R.id.coords);
|
||||
assertThat(coords).containsText(String.valueOf(BMK_LAT));
|
||||
assertThat(coords).containsText(String.valueOf(BMK_LON));
|
||||
|
||||
final Button editBtn = (Button) activity.findViewById(R.id.editBookmark);
|
||||
solo.clickOnView(editBtn);
|
||||
solo.waitForActivity(BookmarkActivity.class, 5000);
|
||||
|
||||
solo.finishOpenedActivities();
|
||||
}
|
||||
|
||||
|
||||
private Intent getBookmarkIntent()
|
||||
{
|
||||
final Intent i = new Intent();
|
||||
i.putExtra(EXTRA_OBJECT_TYPE, MapObjectFragment.MapObjectType.BOOKMARK);
|
||||
i.putExtra(EXTRA_BMK_CAT, catbmk.first);
|
||||
i.putExtra(EXTRA_BMK_INDEX, catbmk.second);
|
||||
return i;
|
||||
}
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
package com.mapswithme.maps.tests;
|
||||
|
||||
import static com.mapswithme.maps.MapObjectActivity.EXTRA_LAT;
|
||||
import static com.mapswithme.maps.MapObjectActivity.EXTRA_LON;
|
||||
import static com.mapswithme.maps.MapObjectActivity.EXTRA_NAME;
|
||||
import static com.mapswithme.maps.MapObjectActivity.EXTRA_OBJECT_TYPE;
|
||||
import static com.mapswithme.maps.MapObjectActivity.EXTRA_TYPE;
|
||||
import static org.fest.assertions.api.ANDROID.assertThat;
|
||||
import android.content.Intent;
|
||||
import android.test.ActivityInstrumentationTestCase2;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.jayway.android.robotium.solo.Solo;
|
||||
import com.mapswithme.maps.MapObjectActivity;
|
||||
import com.mapswithme.maps.MapObjectFragment;
|
||||
import com.mapswithme.maps.R;
|
||||
import com.mapswithme.maps.bookmarks.BookmarkActivity;
|
||||
import com.squareup.spoon.Spoon;
|
||||
|
||||
public class MapObjectActivityPOITest extends ActivityInstrumentationTestCase2<MapObjectActivity>
|
||||
{
|
||||
|
||||
public MapObjectActivityPOITest()
|
||||
{
|
||||
super(MapObjectActivity.class);
|
||||
}
|
||||
|
||||
public void testView_POI()
|
||||
{
|
||||
setActivityIntent(getPOIIntent());
|
||||
final MapObjectActivity activity = getActivity();
|
||||
final Solo solo = new Solo(getInstrumentation(), activity);
|
||||
Spoon.screenshot(activity, "initial_state_poi");
|
||||
|
||||
final TextView name = (TextView) activity.findViewById(R.id.name);
|
||||
assertThat(name).hasText(POI_NAME);
|
||||
|
||||
final TextView type = (TextView) activity.findViewById(R.id.type);
|
||||
assertThat(type).hasText(POI_TYPE);
|
||||
|
||||
final Button editBtn = (Button) activity.findViewById(R.id.editBookmark);
|
||||
assertThat(editBtn).isGone();
|
||||
|
||||
final Button openWithBtn = (Button) activity.findViewById(R.id.openWith);
|
||||
assertThat(openWithBtn).isGone();
|
||||
|
||||
final Button addToBmksButton = (Button) activity.findViewById(R.id.addToBookmarks);
|
||||
solo.clickOnView(addToBmksButton);
|
||||
solo.waitForActivity(BookmarkActivity.class, 5000);
|
||||
|
||||
solo.finishOpenedActivities();
|
||||
}
|
||||
|
||||
private static String POI_NAME = "MapsWithMe Office";
|
||||
private static String POI_TYPE = "Cool place";
|
||||
|
||||
private Intent getPOIIntent()
|
||||
{
|
||||
final Intent i = new Intent();
|
||||
i.putExtra(EXTRA_OBJECT_TYPE, MapObjectFragment.MapObjectType.POI);
|
||||
i.putExtra(EXTRA_NAME, POI_NAME);
|
||||
i.putExtra(EXTRA_TYPE, POI_TYPE);
|
||||
i.putExtra(EXTRA_LAT, 59.9001);
|
||||
i.putExtra(EXTRA_LON, 27.5603);
|
||||
return i;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,102 +0,0 @@
|
|||
package com.mapswithme.maps.tests;
|
||||
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
import android.test.ActivityInstrumentationTestCase2;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Spinner;
|
||||
|
||||
import com.jayway.android.robotium.solo.Solo;
|
||||
import com.mapswithme.maps.R;
|
||||
import com.mapswithme.maps.search.SearchActivity;
|
||||
import com.squareup.spoon.Spoon;
|
||||
|
||||
public class SearchActivityTest extends ActivityInstrumentationTestCase2<SearchActivity>
|
||||
{
|
||||
|
||||
public SearchActivityTest()
|
||||
{
|
||||
super(SearchActivity.class);
|
||||
}
|
||||
|
||||
public void testView_Spinner()
|
||||
{
|
||||
final SearchActivity activity = getActivity();
|
||||
final Spinner spinner = ((Spinner) activity.findViewById(R.id.search_modes_spinner));
|
||||
final EditText searchField = (EditText) activity.findViewById(R.id.search_string);
|
||||
final Solo solo = new Solo(getInstrumentation(), getActivity());
|
||||
solo.clearEditText(searchField);
|
||||
|
||||
Spoon.screenshot(activity, "initial_state");
|
||||
solo.clickOnView(spinner);
|
||||
|
||||
final CountDownLatch cdl = new CountDownLatch(1);
|
||||
spinner.postDelayed(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
cdl.countDown();
|
||||
}
|
||||
}, 3 * 1000);
|
||||
try
|
||||
{
|
||||
cdl.await();
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
fail("Didn't wait for screenshot");
|
||||
}
|
||||
|
||||
Spoon.screenshot(activity, "spinner_clicked");
|
||||
}
|
||||
|
||||
public void testSearch_Search()
|
||||
{
|
||||
final SearchActivity activity = getActivity();
|
||||
final Solo solo = new Solo(getInstrumentation(), getActivity());
|
||||
final Spinner spinner = ((Spinner) activity.findViewById(R.id.search_modes_spinner));
|
||||
|
||||
final EditText searchField = (EditText) activity.findViewById(R.id.search_string);
|
||||
final String[] searchTerms = { "fo", "food", "ресторан", "Ми", "Минск", "Моск", "San", "London", "Cinema" };
|
||||
|
||||
for (String term : searchTerms)
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
final int index = i;
|
||||
getInstrumentation().runOnMainSync(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
spinner.setSelection(index);
|
||||
}
|
||||
});
|
||||
getInstrumentation().waitForIdleSync();
|
||||
|
||||
solo.clearEditText(searchField);
|
||||
solo.enterText(searchField, term);
|
||||
|
||||
final CountDownLatch cdl = new CountDownLatch(1);
|
||||
searchField.postDelayed(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
cdl.countDown();
|
||||
}
|
||||
}, 1500);
|
||||
try
|
||||
{
|
||||
cdl.await();
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
fail("Didn't wait for screenshot");
|
||||
}
|
||||
|
||||
Spoon.screenshot(activity, "search_" + term.hashCode());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
package com.mapswithme.maps.tests;
|
||||
|
||||
import android.preference.CheckBoxPreference;
|
||||
import android.test.ActivityInstrumentationTestCase2;
|
||||
|
||||
import com.mapswithme.maps.R;
|
||||
import com.mapswithme.maps.settings.SettingsActivity;
|
||||
import com.mapswithme.util.statistics.Statistics;
|
||||
import com.squareup.spoon.Spoon;
|
||||
|
||||
public class SettingsActivityTest extends ActivityInstrumentationTestCase2<SettingsActivity>
|
||||
{
|
||||
|
||||
SettingsActivity activity;
|
||||
|
||||
public SettingsActivityTest()
|
||||
{
|
||||
super(SettingsActivity.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
activity = getActivity();
|
||||
}
|
||||
|
||||
public void testSetUp_Settings()
|
||||
{
|
||||
assertNotNull(activity);
|
||||
Spoon.screenshot(activity, "settings");
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void testStat_CheckBox()
|
||||
{
|
||||
CheckBoxPreference pref = (CheckBoxPreference)activity.findPreference(activity.getString(R.string.pref_allow_stat));
|
||||
assertNotNull(pref);
|
||||
assertEquals(Statistics.INSTANCE.isStatisticsEnabled(), pref.isChecked());
|
||||
}
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
package com.mapswithme.maps.tests;
|
||||
|
||||
import android.app.Application;
|
||||
import android.app.KeyguardManager;
|
||||
import android.os.PowerManager;
|
||||
import android.test.InstrumentationTestRunner;
|
||||
|
||||
import static android.content.Context.KEYGUARD_SERVICE;
|
||||
import static android.content.Context.POWER_SERVICE;
|
||||
import static android.os.PowerManager.ACQUIRE_CAUSES_WAKEUP;
|
||||
import static android.os.PowerManager.FULL_WAKE_LOCK;
|
||||
import static android.os.PowerManager.ON_AFTER_RELEASE;
|
||||
|
||||
/**
|
||||
* Test runner which disables the keyguard and wake up the screen during
|
||||
* execution. Requires test application have
|
||||
* {@code android.permission.DISABLE_KEYGUARD} permission declared.
|
||||
**/
|
||||
public class SpoonInstrumentationTestRunner extends InstrumentationTestRunner
|
||||
{
|
||||
@Override
|
||||
public void onStart()
|
||||
{
|
||||
runOnMainSync(new Runnable()
|
||||
{
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
Application app = (Application) getTargetContext().getApplicationContext();
|
||||
String simpleName = SpoonInstrumentationTestRunner.class.getSimpleName();
|
||||
try
|
||||
{
|
||||
// Unlock the device so that the tests can input keystrokes.
|
||||
((KeyguardManager) app.getSystemService(KEYGUARD_SERVICE))
|
||||
.newKeyguardLock(simpleName)
|
||||
.disableKeyguard();
|
||||
// Wake up the screen.
|
||||
((PowerManager) app.getSystemService(POWER_SERVICE)) //
|
||||
.newWakeLock(FULL_WAKE_LOCK | ACQUIRE_CAUSES_WAKEUP | ON_AFTER_RELEASE, simpleName)
|
||||
.acquire();
|
||||
}
|
||||
catch (SecurityException e)
|
||||
{
|
||||
// because of Kinlde we could just have this exception thrown
|
||||
}
|
||||
}
|
||||
});
|
||||
super.onStart();
|
||||
}
|
||||
}
|
Binary file not shown.
Loading…
Add table
Reference in a new issue