Skip to content
This repository has been archived by the owner on Nov 14, 2019. It is now read-only.

Commit

Permalink
Initial Setup of Tests. #49
Browse files Browse the repository at this point in the history
  • Loading branch information
svijee committed Jul 28, 2013
1 parent 05fa21e commit 7538687
Show file tree
Hide file tree
Showing 13 changed files with 158 additions and 5 deletions.
2 changes: 1 addition & 1 deletion taskwarrior-androidapp/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

# Project target.
target=android-15
target=android-18
android.library.reference.1=../com_actionbar
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,14 @@
import java.util.GregorianCalendar;
import java.util.UUID;

import org.svij.taskwarriorapp.TaskAddActivity.UnsavedDataDialogFragment;
import org.svij.taskwarriorapp.data.Task;
import org.svij.taskwarriorapp.db.TaskBaseAdapter;
import org.svij.taskwarriorapp.db.TaskDataSource;

import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.NavUtils;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
Expand Down
10 changes: 10 additions & 0 deletions taskwarrior-androidapp/tests/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry combineaccessrules="false" kind="src" path="/TasksActivity"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
34 changes: 34 additions & 0 deletions taskwarrior-androidapp/tests/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>tests</name>
<comment></comment>
<projects>
<project>TasksActivity</project>
</projects>
<buildSpec>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
19 changes: 19 additions & 0 deletions taskwarrior-androidapp/tests/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.svij.taskwarriorapp.test"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk android:minSdkVersion="15" />

<instrumentation
android:name="android.test.InstrumentationTestRunner"
android:targetPackage="org.svij.taskwarriorapp" />

<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<uses-library android:name="android.test.runner" />
</application>

</manifest>
20 changes: 20 additions & 0 deletions taskwarrior-androidapp/tests/proguard-project.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 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 *;
#}
14 changes: 14 additions & 0 deletions taskwarrior-androidapp/tests/project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# 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-18
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions taskwarrior-androidapp/tests/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<string name="app_name">TestsTest</string>

</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package org.svij.taskwarriorapp.test;

import org.svij.taskwarriorapp.ArrayListFragment;
import org.svij.taskwarriorapp.TaskAddActivity;
import org.svij.taskwarriorapp.TasksActivity;

import android.app.Instrumentation;
import android.test.ActivityInstrumentationTestCase2;
import android.test.InstrumentationTestRunner;
import android.test.TouchUtils;
import android.view.View;
import android.widget.ListView;
import android.widget.RelativeLayout;

public class TaskActivityTest extends
ActivityInstrumentationTestCase2<TasksActivity> {
private TasksActivity taskActivity;
private TaskAddActivity taskAddActivity;
private ArrayListFragment alFragment;

public TaskActivityTest() {
super(TasksActivity.class);
}

protected void setUp() throws Exception {
super.setUp();

setActivityInitialTouchMode(false);
taskActivity = (TasksActivity) getActivity();
alFragment = (ArrayListFragment) taskActivity
.getSupportFragmentManager().findFragmentById(
org.svij.taskwarriorapp.R.id.content_frame);
}

protected void tearDown() throws Exception {

}

public void testListView() {

assertNotNull(taskActivity
.findViewById(org.svij.taskwarriorapp.R.id.task_add));
assertNotNull(taskActivity
.findViewById(org.svij.taskwarriorapp.R.id.task_sync));

ListView lv = alFragment.getListView();

for (int i = 0; i < lv.getCount(); i++) {
RelativeLayout view = (RelativeLayout) lv.getChildAt(i);
assertNotNull(view);
TouchUtils.clickView(this, view);
}
}
}

0 comments on commit 7538687

Please sign in to comment.