gametel 0.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -3
- data/ApiDemos/res/layout/buttons_1.xml +6 -0
- data/ApiDemos/res/layout/controls_1.xml +1 -0
- data/ApiDemos/res/values/strings.xml +1 -0
- data/ApiDemos/src/com/example/android/apis/accessibility/ClockBackActivity.java +0 -1
- data/ApiDemos/src/com/example/android/apis/accessibility/TaskBackService.java +0 -1
- data/ApiDemos/src/com/example/android/apis/accessibility/TaskListActivity.java +0 -1
- data/ApiDemos/src/com/example/android/apis/accessibility/TaskListView.java +0 -4
- data/ApiDemos/src/com/example/android/apis/app/ActionBarSettingsActionProviderActivity.java +0 -1
- data/ApiDemos/src/com/example/android/apis/app/DeviceAdminSample.java +0 -4
- data/ApiDemos/src/com/example/android/apis/app/LoaderCursor.java +1 -1
- data/ApiDemos/src/com/example/android/apis/app/LoaderCustom.java +5 -6
- data/ApiDemos/src/com/example/android/apis/app/VoiceRecognition.java +0 -4
- data/ApiDemos/src/com/example/android/apis/content/FileProvider.java +0 -1
- data/ApiDemos/src/com/example/android/apis/view/GameControllerInput.java +4 -11
- data/ApiDemos/src/com/example/android/apis/view/Hover.java +1 -11
- data/ApiDemos/src/com/example/android/apis/view/Switches.java +0 -1
- data/ChangeLog +10 -0
- data/README.md +14 -1
- data/cucumber.yml +10 -2
- data/features/button.feature +5 -0
- data/features/checkbox.feature +4 -0
- data/features/is_enabled.feature +9 -0
- data/features/list_item.feature +4 -0
- data/features/main_screen.feature +5 -0
- data/features/radio_button.feature +3 -0
- data/features/step_definitions/button_steps.rb +4 -0
- data/features/step_definitions/controls_steps.rb +12 -3
- data/features/step_definitions/is_enabled_steps.rb +7 -0
- data/features/step_definitions/list_item_steps.rb +4 -0
- data/features/step_definitions/main_screen_steps.rb +6 -0
- data/features/step_definitions/view_steps.rb +20 -0
- data/features/support/app_installation_hooks.rb +9 -17
- data/features/support/app_life_cycle_hooks.rb +4 -21
- data/features/support/screens/alert_dialogs_screen.rb +5 -0
- data/features/support/screens/app_menu_screen.rb +6 -0
- data/features/support/screens/auto_complete_menu_screen.rb +11 -0
- data/features/support/screens/auto_complete_screen_top_screen.rb +7 -0
- data/features/support/screens/buttons_screen.rb +1 -0
- data/features/support/screens/controls_screen.rb +5 -2
- data/features/support/screens/custom_views_screen.rb +7 -0
- data/features/support/screens/main_menu_screen.rb +1 -0
- data/features/text.feature +33 -3
- data/features/view.feature +11 -0
- data/gametel.gemspec +2 -2
- data/lib/gametel.rb +14 -0
- data/lib/gametel/accessors.rb +40 -3
- data/lib/gametel/platforms/calabash.rb +42 -3
- data/lib/gametel/version.rb +1 -1
- data/spec/lib/gametel/accessors_spec.rb +102 -32
- data/spec/lib/gametel_spec.rb +10 -0
- metadata +23 -13
- data/ApiDemos/bin/ApiDemos.apk +0 -0
- data/ApiDemos/local.properties +0 -10
data/.gitignore
CHANGED
@@ -41,6 +41,12 @@
|
|
41
41
|
android:text="@string/buttons_1_toggle"
|
42
42
|
android:layout_width="wrap_content"
|
43
43
|
android:layout_height="wrap_content" />
|
44
|
+
|
45
|
+
<Button android:id="@+id/button_disabled"
|
46
|
+
android:text="Disabled"
|
47
|
+
android:enabled="false"
|
48
|
+
android:layout_width="wrap_content"
|
49
|
+
android:layout_height="wrap_content" />
|
44
50
|
|
45
51
|
</LinearLayout>
|
46
52
|
|
@@ -968,6 +968,7 @@
|
|
968
968
|
<string name="baseline_7_lean">Slim and slick.</string>
|
969
969
|
<string name="baseline_nested_1_label">label</string>
|
970
970
|
<string name="controls_1_save">Save</string>
|
971
|
+
<string name="controls_1_edit_desc">Edit Description</string>
|
971
972
|
<string name="controls_1_checkbox_1">Checkbox 1</string>
|
972
973
|
<string name="controls_1_checkbox_2">Checkbox 2</string>
|
973
974
|
<string name="controls_1_radiobutton_1">RadioButton 1</string>
|
@@ -46,7 +46,6 @@ public class ClockBackActivity extends Activity {
|
|
46
46
|
// Add a shortcut to the accessibility settings.
|
47
47
|
ImageButton button = (ImageButton) findViewById(R.id.button);
|
48
48
|
button.setOnClickListener(new View.OnClickListener() {
|
49
|
-
@Override
|
50
49
|
public void onClick(View v) {
|
51
50
|
startActivity(sSettingsIntent);
|
52
51
|
}
|
@@ -168,7 +168,6 @@ public class TaskBackService extends AccessibilityService implements OnInitListe
|
|
168
168
|
/**
|
169
169
|
* {@inheritDoc}
|
170
170
|
*/
|
171
|
-
@Override
|
172
171
|
public void onInit(int status) {
|
173
172
|
// Set a flag so that the TaskBackService knows that the Text-To-Speech
|
174
173
|
// engine has been initialized, and can now handle speaking requests.
|
@@ -50,7 +50,6 @@ public class TaskListActivity extends ListActivity {
|
|
50
50
|
// Add a shortcut to the accessibility settings.
|
51
51
|
ImageButton button = (ImageButton) findViewById(R.id.button);
|
52
52
|
button.setOnClickListener(new View.OnClickListener() {
|
53
|
-
@Override
|
54
53
|
public void onClick(View v) {
|
55
54
|
startActivity(sSettingsIntent);
|
56
55
|
}
|
@@ -75,7 +75,6 @@ final class TaskAdapter extends BaseAdapter{
|
|
75
75
|
mCheckboxes = checkboxes;
|
76
76
|
}
|
77
77
|
|
78
|
-
@Override
|
79
78
|
public int getCount() {
|
80
79
|
return mLabels.length;
|
81
80
|
}
|
@@ -83,7 +82,6 @@ final class TaskAdapter extends BaseAdapter{
|
|
83
82
|
/** Expands the views for individual list entries, and sets content descriptions for use by the
|
84
83
|
* TaskBackAccessibilityService.
|
85
84
|
*/
|
86
|
-
@Override
|
87
85
|
public View getView(int position, View convertView, ViewGroup parent) {
|
88
86
|
if(convertView == null) {
|
89
87
|
LayoutInflater inflater = LayoutInflater.from(mContext);
|
@@ -107,12 +105,10 @@ final class TaskAdapter extends BaseAdapter{
|
|
107
105
|
return convertView;
|
108
106
|
}
|
109
107
|
|
110
|
-
@Override
|
111
108
|
public Object getItem(int position) {
|
112
109
|
return mLabels[position];
|
113
110
|
}
|
114
111
|
|
115
|
-
@Override
|
116
112
|
public long getItemId(int position) {
|
117
113
|
return position;
|
118
114
|
}
|
@@ -90,7 +90,6 @@ public class ActionBarSettingsActionProviderActivity extends Activity {
|
|
90
90
|
ImageButton button = (ImageButton) view.findViewById(R.id.button);
|
91
91
|
// Attach a click listener for launching the system settings.
|
92
92
|
button.setOnClickListener(new View.OnClickListener() {
|
93
|
-
@Override
|
94
93
|
public void onClick(View v) {
|
95
94
|
mContext.startActivity(sSettingsIntent);
|
96
95
|
}
|
@@ -194,7 +194,6 @@ public class DeviceAdminSample extends PreferenceActivity {
|
|
194
194
|
}
|
195
195
|
}
|
196
196
|
|
197
|
-
@Override
|
198
197
|
public boolean onPreferenceClick(Preference preference) {
|
199
198
|
if (mSetPassword != null && preference == mSetPassword) {
|
200
199
|
Intent intent = new Intent(DevicePolicyManager.ACTION_SET_NEW_PASSWORD);
|
@@ -204,7 +203,6 @@ public class DeviceAdminSample extends PreferenceActivity {
|
|
204
203
|
return false;
|
205
204
|
}
|
206
205
|
|
207
|
-
@Override
|
208
206
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
209
207
|
if (mResetPassword != null && preference == mResetPassword) {
|
210
208
|
doResetPassword((String)newValue);
|
@@ -717,7 +715,6 @@ public class DeviceAdminSample extends PreferenceActivity {
|
|
717
715
|
builder.setMessage(R.string.wipe_warning_first);
|
718
716
|
builder.setPositiveButton(R.string.wipe_warning_first_ok,
|
719
717
|
new DialogInterface.OnClickListener() {
|
720
|
-
@Override
|
721
718
|
public void onClick(DialogInterface dialog, int which) {
|
722
719
|
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
723
720
|
if (wipeAllData) {
|
@@ -727,7 +724,6 @@ public class DeviceAdminSample extends PreferenceActivity {
|
|
727
724
|
}
|
728
725
|
builder.setPositiveButton(R.string.wipe_warning_second_ok,
|
729
726
|
new DialogInterface.OnClickListener() {
|
730
|
-
@Override
|
731
727
|
public void onClick(DialogInterface dialog, int which) {
|
732
728
|
boolean stillActive = mActivity.isActiveAdmin();
|
733
729
|
if (stillActive) {
|
@@ -148,7 +148,6 @@ public class LoaderCustom extends Activity {
|
|
148
148
|
*/
|
149
149
|
public static final Comparator<AppEntry> ALPHA_COMPARATOR = new Comparator<AppEntry>() {
|
150
150
|
private final Collator sCollator = Collator.getInstance();
|
151
|
-
@Override
|
152
151
|
public int compare(AppEntry object1, AppEntry object2) {
|
153
152
|
return sCollator.compare(object1.getLabel(), object2.getLabel());
|
154
153
|
}
|
@@ -437,7 +436,7 @@ public class LoaderCustom extends Activity {
|
|
437
436
|
item.setActionView(sv);
|
438
437
|
}
|
439
438
|
|
440
|
-
|
439
|
+
public boolean onQueryTextChange(String newText) {
|
441
440
|
// Called when the action bar search text has changed. Since this
|
442
441
|
// is a simple array adapter, we can just have it do the filtering.
|
443
442
|
mCurFilter = !TextUtils.isEmpty(newText) ? newText : null;
|
@@ -445,7 +444,7 @@ public class LoaderCustom extends Activity {
|
|
445
444
|
return true;
|
446
445
|
}
|
447
446
|
|
448
|
-
|
447
|
+
public boolean onQueryTextSubmit(String query) {
|
449
448
|
// Don't care about this.
|
450
449
|
return true;
|
451
450
|
}
|
@@ -455,13 +454,13 @@ public class LoaderCustom extends Activity {
|
|
455
454
|
Log.i("LoaderCustom", "Item clicked: " + id);
|
456
455
|
}
|
457
456
|
|
458
|
-
|
457
|
+
public Loader<List<AppEntry>> onCreateLoader(int id, Bundle args) {
|
459
458
|
// This is called when a new Loader needs to be created. This
|
460
459
|
// sample only has one Loader with no arguments, so it is simple.
|
461
460
|
return new AppListLoader(getActivity());
|
462
461
|
}
|
463
462
|
|
464
|
-
|
463
|
+
public void onLoadFinished(Loader<List<AppEntry>> loader, List<AppEntry> data) {
|
465
464
|
// Set the new data in the adapter.
|
466
465
|
mAdapter.setData(data);
|
467
466
|
|
@@ -473,7 +472,7 @@ public class LoaderCustom extends Activity {
|
|
473
472
|
}
|
474
473
|
}
|
475
474
|
|
476
|
-
|
475
|
+
public void onLoaderReset(Loader<List<AppEntry>> loader) {
|
477
476
|
// Clear the data in the adapter.
|
478
477
|
mAdapter.setData(null);
|
479
478
|
}
|
@@ -184,7 +184,6 @@ public class VoiceRecognition extends Activity implements OnClickListener {
|
|
184
184
|
|
185
185
|
if (getResultCode() != Activity.RESULT_OK) {
|
186
186
|
mHandler.post(new Runnable() {
|
187
|
-
@Override
|
188
187
|
public void run() {
|
189
188
|
showToast("Error code:" + getResultCode());
|
190
189
|
}
|
@@ -193,7 +192,6 @@ public class VoiceRecognition extends Activity implements OnClickListener {
|
|
193
192
|
|
194
193
|
if (extra == null) {
|
195
194
|
mHandler.post(new Runnable() {
|
196
|
-
@Override
|
197
195
|
public void run() {
|
198
196
|
showToast("No extra");
|
199
197
|
}
|
@@ -203,7 +201,6 @@ public class VoiceRecognition extends Activity implements OnClickListener {
|
|
203
201
|
if (extra.containsKey(RecognizerIntent.EXTRA_SUPPORTED_LANGUAGES)) {
|
204
202
|
mHandler.post(new Runnable() {
|
205
203
|
|
206
|
-
@Override
|
207
204
|
public void run() {
|
208
205
|
updateSupportedLanguages(extra.getStringArrayList(
|
209
206
|
RecognizerIntent.EXTRA_SUPPORTED_LANGUAGES));
|
@@ -214,7 +211,6 @@ public class VoiceRecognition extends Activity implements OnClickListener {
|
|
214
211
|
if (extra.containsKey(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE)) {
|
215
212
|
mHandler.post(new Runnable() {
|
216
213
|
|
217
|
-
@Override
|
218
214
|
public void run() {
|
219
215
|
updateLanguagePreference(
|
220
216
|
extra.getString(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE));
|
@@ -88,7 +88,6 @@ public class FileProvider extends ContentProvider
|
|
88
88
|
}
|
89
89
|
}
|
90
90
|
|
91
|
-
@Override
|
92
91
|
public void writeDataToPipe(ParcelFileDescriptor output, Uri uri, String mimeType,
|
93
92
|
Bundle opts, InputStream args) {
|
94
93
|
// Transfer data from the asset to the pipe the client is reading.
|
@@ -16,33 +16,31 @@
|
|
16
16
|
|
17
17
|
package com.example.android.apis.view;
|
18
18
|
|
19
|
-
import
|
19
|
+
import java.util.ArrayList;
|
20
|
+
import java.util.List;
|
20
21
|
|
21
22
|
import android.app.Activity;
|
22
23
|
import android.content.Context;
|
23
24
|
import android.content.res.Resources;
|
24
25
|
import android.os.Bundle;
|
25
|
-
import android.util.AttributeSet;
|
26
26
|
import android.util.Log;
|
27
27
|
import android.util.SparseArray;
|
28
28
|
import android.util.SparseIntArray;
|
29
29
|
import android.view.InputDevice;
|
30
|
+
import android.view.InputDevice.MotionRange;
|
30
31
|
import android.view.InputEvent;
|
31
32
|
import android.view.KeyEvent;
|
32
33
|
import android.view.LayoutInflater;
|
33
34
|
import android.view.MotionEvent;
|
34
35
|
import android.view.View;
|
35
36
|
import android.view.ViewGroup;
|
36
|
-
import android.view.InputDevice.MotionRange;
|
37
37
|
import android.widget.AdapterView;
|
38
38
|
import android.widget.BaseAdapter;
|
39
39
|
import android.widget.ListView;
|
40
40
|
import android.widget.TextView;
|
41
41
|
import android.widget.Toast;
|
42
42
|
|
43
|
-
import
|
44
|
-
import java.util.List;
|
45
|
-
import java.util.concurrent.atomic.AtomicLong;
|
43
|
+
import com.example.android.apis.R;
|
46
44
|
|
47
45
|
|
48
46
|
/**
|
@@ -76,7 +74,6 @@ public class GameControllerInput extends Activity {
|
|
76
74
|
mSummaryList = (ListView) findViewById(R.id.summary);
|
77
75
|
mSummaryList.setAdapter(mSummaryAdapter);
|
78
76
|
mSummaryList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
79
|
-
@Override
|
80
77
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
81
78
|
mSummaryAdapter.onItemClick(position);
|
82
79
|
}
|
@@ -368,22 +365,18 @@ public class GameControllerInput extends Activity {
|
|
368
365
|
return true;
|
369
366
|
}
|
370
367
|
|
371
|
-
@Override
|
372
368
|
public int getCount() {
|
373
369
|
return mVisibleItems.size();
|
374
370
|
}
|
375
371
|
|
376
|
-
@Override
|
377
372
|
public Item getItem(int position) {
|
378
373
|
return mVisibleItems.get(position);
|
379
374
|
}
|
380
375
|
|
381
|
-
@Override
|
382
376
|
public long getItemId(int position) {
|
383
377
|
return getItem(position).getItemId();
|
384
378
|
}
|
385
379
|
|
386
|
-
@Override
|
387
380
|
public View getView(int position, View convertView, ViewGroup parent) {
|
388
381
|
return getItem(position).getView(convertView, parent);
|
389
382
|
}
|
@@ -16,24 +16,16 @@
|
|
16
16
|
|
17
17
|
package com.example.android.apis.view;
|
18
18
|
|
19
|
-
import com.example.android.apis.R;
|
20
|
-
|
21
19
|
import android.app.Activity;
|
22
|
-
import android.content.Context;
|
23
|
-
import android.content.res.Resources;
|
24
20
|
import android.os.Bundle;
|
25
|
-
import android.util.AttributeSet;
|
26
|
-
import android.util.Log;
|
27
|
-
import android.view.LayoutInflater;
|
28
21
|
import android.view.MotionEvent;
|
29
22
|
import android.view.View;
|
30
23
|
import android.view.ViewGroup;
|
31
24
|
import android.widget.CheckBox;
|
32
25
|
import android.widget.CompoundButton;
|
33
|
-
import android.widget.LinearLayout;
|
34
26
|
import android.widget.TextView;
|
35
27
|
|
36
|
-
import
|
28
|
+
import com.example.android.apis.R;
|
37
29
|
|
38
30
|
|
39
31
|
/**
|
@@ -73,7 +65,6 @@ public class Hover extends Activity {
|
|
73
65
|
|
74
66
|
View container = findViewById(R.id.container);
|
75
67
|
container.setOnHoverListener(new View.OnHoverListener() {
|
76
|
-
@Override
|
77
68
|
public boolean onHover(View v, MotionEvent event) {
|
78
69
|
switch (event.getAction()) {
|
79
70
|
case MotionEvent.ACTION_HOVER_ENTER:
|
@@ -97,7 +88,6 @@ public class Hover extends Activity {
|
|
97
88
|
});
|
98
89
|
|
99
90
|
mInterceptCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
100
|
-
@Override
|
101
91
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
102
92
|
mInterceptor.setInterceptHover(isChecked);
|
103
93
|
}
|
@@ -40,7 +40,6 @@ public class Switches extends Activity implements CompoundButton.OnCheckedChange
|
|
40
40
|
}
|
41
41
|
}
|
42
42
|
|
43
|
-
@Override
|
44
43
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
45
44
|
Toast.makeText(this, "Monitored switch is " + (isChecked ? "on" : "off"),
|
46
45
|
Toast.LENGTH_SHORT).show();
|
data/ChangeLog
CHANGED
@@ -1,2 +1,12 @@
|
|
1
|
+
=== Version 0.2 / 2012-8-14
|
2
|
+
* Enhancements
|
3
|
+
* Added the enter method to Gametel module to press the enter key on the device
|
4
|
+
* Added generated method to clear a text view
|
5
|
+
* Added generated method to click a view, button, checkbox or radio by id
|
6
|
+
* Added ability to enter and clear text from a text view identified by id
|
7
|
+
* Added :list locator that can be used with :index locator to select the target list
|
8
|
+
* Renamed the :name locator to :content_description for text so it more accurately reflects what it is doing
|
9
|
+
* Added support for determining if a view is enabled / disabled
|
10
|
+
|
1
11
|
=== Version 0.1 / 2012-7-17
|
2
12
|
Initial release with very basic support for a few controls
|
data/README.md
CHANGED
@@ -22,7 +22,7 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
### Defining your screen object
|
24
24
|
````ruby
|
25
|
-
class
|
25
|
+
class LoginPage
|
26
26
|
include Gametel
|
27
27
|
end
|
28
28
|
````
|
@@ -49,6 +49,19 @@ on(LoginPage) do |screen|
|
|
49
49
|
end
|
50
50
|
````
|
51
51
|
|
52
|
+
## Supported Drivers
|
53
|
+
|
54
|
+
### Calabash Android
|
55
|
+
|
56
|
+
Sample `features/support/env.rb` file.
|
57
|
+
|
58
|
+
````ruby
|
59
|
+
require 'calabash-android/cucumber'
|
60
|
+
require 'gametel'
|
61
|
+
require 'gametel/navigation'
|
62
|
+
|
63
|
+
World(Gametel::Navigation)
|
64
|
+
````
|
52
65
|
|
53
66
|
## Contributing
|
54
67
|
|
data/cucumber.yml
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
<%
|
2
|
-
|
2
|
+
begin
|
3
|
+
puts 'Building the calabash test server...'
|
4
|
+
last_test_apk = 'test_servers/' << Dir.entries("test_servers").last
|
5
|
+
rescue
|
6
|
+
`calabash-android build ApiDemos/bin/ApiDemos.apk`
|
7
|
+
retry
|
8
|
+
end
|
9
|
+
|
10
|
+
std_opts = "PACKAGE_NAME=com.example.android.apis TEST_PACKAGE_NAME=com.example.android.apis.test APP_PATH=./ApiDemos/bin/ApiDemos.apk TEST_APP_PATH=#{last_test_apk} TEST_SERVER_PORT=34777 --no-source --color --format pretty"
|
3
11
|
%>
|
4
12
|
|
5
|
-
default: <%= std_opts %>
|
13
|
+
default: <%= std_opts %> --tags ~@ignore
|
6
14
|
focus: <%= std_opts %> --tags @focus
|
data/features/button.feature
CHANGED
@@ -8,6 +8,11 @@ Feature: Interacting with buttons
|
|
8
8
|
Given I'm on the buttons screen
|
9
9
|
Then I should be able to click the button by "index"
|
10
10
|
|
11
|
+
Scenario: Should be able to click a button by id
|
12
|
+
Given I'm on the buttons screen
|
13
|
+
When I click the on/off button by "id"
|
14
|
+
Then I should see the text "ON" on the screen
|
15
|
+
|
11
16
|
Scenario: Should be able to click a toggle button
|
12
17
|
Given I'm on the buttons screen
|
13
18
|
When I click the on/off button
|
data/features/checkbox.feature
CHANGED
@@ -7,3 +7,7 @@ Feature: Interacting with checkboxes
|
|
7
7
|
Scenario: Clicking on a checkbox by text
|
8
8
|
Given I'm on the controls screen
|
9
9
|
Then I should be able to click a checkbox by "text"
|
10
|
+
|
11
|
+
Scenario: Clicking a checkbox by id
|
12
|
+
Given I'm on the controls screen
|
13
|
+
Then I should be able to click a checkbox by "id"
|