Skip to content

Commit 8688763

Browse files
committed
update tests and ask storage permissions on initial image download
1 parent 7f31d80 commit 8688763

File tree

6 files changed

+30
-11
lines changed

6 files changed

+30
-11
lines changed

app/src/androidTest/java/mavonie/subterminal/SettingsTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import static android.support.test.espresso.action.ViewActions.closeSoftKeyboard;
2222
import static android.support.test.espresso.action.ViewActions.pressImeActionButton;
2323
import static android.support.test.espresso.action.ViewActions.replaceText;
24+
import static android.support.test.espresso.action.ViewActions.scrollTo;
2425
import static android.support.test.espresso.assertion.ViewAssertions.matches;
2526
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
2627
import static android.support.test.espresso.matcher.ViewMatchers.withId;
@@ -164,6 +165,9 @@ public void testBaseDefaults() {
164165
allOf(withId(android.R.id.text1), withText(sliderSelect), isDisplayed()));
165166
appCompatCheckedTextView2.perform(click());
166167

168+
169+
onView(allOf(withId(R.id.preference_default_pc_size_value))).perform(scrollTo());
170+
167171
ViewInteraction appCompatSpinner2 = onView(
168172
allOf(withId(R.id.preference_default_pc_size_value), isDisplayed()));
169173
appCompatSpinner2.perform(click());

app/src/androidTest/java/mavonie/subterminal/Skydiving/DropzoneTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
import static android.support.test.espresso.Espresso.onView;
2626
import static android.support.test.espresso.action.ViewActions.click;
27+
import static android.support.test.espresso.action.ViewActions.scrollTo;
2728
import static android.support.test.espresso.assertion.ViewAssertions.matches;
2829
import static android.support.test.espresso.contrib.RecyclerViewActions.actionOnItemAtPosition;
2930
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
@@ -52,6 +53,8 @@ public void openDropzoneTest() {
5253
isDisplayed()));
5354
recyclerView.perform(actionOnItemAtPosition(3, click()));
5455

56+
onView(allOf(withId(R.id.contact_layout_website))).perform(scrollTo());
57+
5558
ViewInteraction textView = onView(
5659
allOf(withText("Website"),
5760
childAtPosition(
@@ -73,6 +76,8 @@ public void openDropzoneTest() {
7376
isDisplayed()));
7477
textView2.check(matches(withText("Email")));
7578

79+
onView(allOf(withId(R.id.dropzone_view_map))).perform(scrollTo());
80+
7681
ViewInteraction textView3 = onView(
7782
allOf(withText("Map"),
7883
childAtPosition(

app/src/androidTest/java/mavonie/subterminal/Skydiving/RigTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,8 @@ public void rigTest() {
202202
isDisplayed()));
203203
editText4.check(matches(withText(containerDate)));
204204

205+
onView(allOf(withId(R.id.edit_canopy_manufacturer))).perform(scrollTo());
206+
205207
ViewInteraction editTextMain = onView(
206208
allOf(withId(R.id.edit_canopy_manufacturer), withText(mainManufacturer),
207209
childAtPosition(
@@ -242,6 +244,8 @@ public void rigTest() {
242244
isDisplayed()));
243245
editText4Main.check(matches(withText(mainDate)));
244246

247+
onView(allOf(withId(R.id.edit_reserve_manufacturer))).perform(scrollTo());
248+
245249
ViewInteraction editTextReserve = onView(
246250
allOf(withId(R.id.edit_reserve_manufacturer), withText(reserveManufacturer),
247251
childAtPosition(
@@ -284,6 +288,8 @@ public void rigTest() {
284288
isDisplayed()));
285289
editText4Reserve.check(matches(withText(reserveDate)));
286290

291+
onView(allOf(withId(R.id.edit_aad_manufacturer))).perform(scrollTo());
292+
287293
ViewInteraction editTextAad = onView(
288294
allOf(withId(R.id.edit_aad_manufacturer), withText(aadManufacturer),
289295
childAtPosition(

app/src/androidTest/java/mavonie/subterminal/Skydiving/SkydiveTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,24 +158,24 @@ public void skydiveTest() {
158158
textView5.check(matches(withText("Tracking")));
159159

160160
ViewInteraction textView6 = onView(
161-
allOf(withId(R.id.skydive_view_altitude), withText("12345"),
161+
allOf(withId(R.id.skydive_view_altitude), withText("12,345ft"),
162162
childAtPosition(
163163
childAtPosition(
164164
IsInstanceOf.<View>instanceOf(android.widget.TableLayout.class),
165165
6),
166166
0),
167167
isDisplayed()));
168-
textView6.check(matches(withText("12345")));
168+
textView6.check(matches(withText("12,345ft")));
169169

170170
ViewInteraction textView7 = onView(
171-
allOf(withId(R.id.skydive_view_deplpoy_altitude), withText("3214"),
171+
allOf(withId(R.id.skydive_view_deplpoy_altitude), withText("3,214ft"),
172172
childAtPosition(
173173
childAtPosition(
174174
IsInstanceOf.<View>instanceOf(android.widget.TableLayout.class),
175175
6),
176176
1),
177177
isDisplayed()));
178-
textView7.check(matches(withText("3214")));
178+
textView7.check(matches(withText("3,214ft")));
179179

180180
ViewInteraction textView8 = onView(
181181
allOf(withId(R.id.skydive_view_delay), withText("54s"),

app/src/main/java/mavonie/subterminal/Models/Image.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -363,12 +363,16 @@ public ImageRunnable(List<Image> images, String server_time) {
363363

364364
@Override
365365
public void run() {
366-
for (Image image : this.images) {
367-
Subterminal.getJobManager(MainActivity.getActivity()).addJobInBackground(new DownloadImage(image));
368-
}
366+
if (PackageManager.PERMISSION_GRANTED == ActivityCompat.checkSelfPermission(MainActivity.getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
367+
for (Image image : this.images) {
368+
Subterminal.getJobManager(MainActivity.getActivity()).addJobInBackground(new DownloadImage(image));
369+
}
369370

370-
//Make sure we only set the sync time once every download has completed
371-
Synchronized.setLastSyncPref(Synchronized.PREF_LAST_SYNC_IMAGE, this.server_time);
371+
//Make sure we only set the sync time once every download has completed
372+
Synchronized.setLastSyncPref(Synchronized.PREF_LAST_SYNC_IMAGE, this.server_time);
373+
} else {
374+
verifyStoragePermissions(MainActivity.getActivity());
375+
}
372376
}
373377
}
374378
}

app/src/main/res/layout/fragment_exit_form.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@
155155
android:layout_width="match_parent"
156156
android:layout_height="wrap_content"
157157
android:hint="0.0000"
158-
android:inputType="numberDecimal"/>
158+
android:inputType="numberSigned"/>
159159
</LinearLayout>
160160

161161

@@ -175,7 +175,7 @@
175175
android:layout_width="match_parent"
176176
android:layout_height="wrap_content"
177177
android:hint="0.0000"
178-
android:inputType="numberDecimal"/>
178+
android:inputType="numberSigned"/>
179179
</LinearLayout>
180180
</LinearLayout>
181181

0 commit comments

Comments
 (0)