forked from upstream-mirrors/OpenTracks
Change code style of SettingTest.testChangePreferredUnits.
This commit is contained in:
@@ -119,8 +119,7 @@ public class ChartView extends View {
|
|||||||
private int effectiveHeight = 0;
|
private int effectiveHeight = 0;
|
||||||
|
|
||||||
private boolean chartByDistance = true;
|
private boolean chartByDistance = true;
|
||||||
@VisibleForTesting
|
private boolean metricUnits = true;
|
||||||
public boolean metricUnits = true;
|
|
||||||
private boolean reportSpeed = true;
|
private boolean reportSpeed = true;
|
||||||
private boolean showPointer = false;
|
private boolean showPointer = false;
|
||||||
|
|
||||||
@@ -1001,4 +1000,14 @@ public class ChartView extends View {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the status of metricUnits.
|
||||||
|
*
|
||||||
|
* @return the status of metricUnits
|
||||||
|
*/
|
||||||
|
@VisibleForTesting
|
||||||
|
public boolean isMetricUnits() {
|
||||||
|
return metricUnits;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-2
@@ -498,7 +498,9 @@ public class EndToEndTestUtils {
|
|||||||
ArrayList<TextView> textViews = EndToEndTestUtils.SOLO.getCurrentTextViews(parent);
|
ArrayList<TextView> textViews = EndToEndTestUtils.SOLO.getCurrentTextViews(parent);
|
||||||
for (TextView textView : textViews) {
|
for (TextView textView : textViews) {
|
||||||
String text = (String) textView.getText();
|
String text = (String) textView.getText();
|
||||||
if (textView.isShown() && text.endsWith(findText)) { return textView; }
|
if (textView.isShown() && text.endsWith(findText)) {
|
||||||
|
return textView;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -511,7 +513,9 @@ public class EndToEndTestUtils {
|
|||||||
static ChartView getChartView() {
|
static ChartView getChartView() {
|
||||||
ArrayList<View> views = EndToEndTestUtils.SOLO.getViews();
|
ArrayList<View> views = EndToEndTestUtils.SOLO.getViews();
|
||||||
for (View view : views) {
|
for (View view : views) {
|
||||||
if (view instanceof ChartView) { return (ChartView) view; }
|
if (view instanceof ChartView) {
|
||||||
|
return (ChartView) view;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -131,14 +131,11 @@ public class SettingTest extends ActivityInstrumentationTestCase2<TrackListActiv
|
|||||||
assertTrue(EndToEndTestUtils.SOLO.waitForText(activityMyTracks
|
assertTrue(EndToEndTestUtils.SOLO.waitForText(activityMyTracks
|
||||||
.getString(R.string.settings_stats_units_title)));
|
.getString(R.string.settings_stats_units_title)));
|
||||||
|
|
||||||
boolean isImperial = !(EndToEndTestUtils.findTextView(activityMyTracks
|
boolean isImperial = EndToEndTestUtils.findTextView(activityMyTracks
|
||||||
.getString(R.string.settings_stats_units_imperial), EndToEndTestUtils.SOLO
|
.getString(R.string.settings_stats_units_imperial), EndToEndTestUtils.SOLO
|
||||||
.getCurrentListViews().get(0)) == null);
|
.getCurrentListViews().get(0)) != null;
|
||||||
assertEquals(isImperial, EndToEndTestUtils.findTextView(activityMyTracks
|
|
||||||
.getString(R.string.settings_stats_units_metric), EndToEndTestUtils.SOLO
|
|
||||||
.getCurrentListViews().get(0)) == null);
|
|
||||||
|
|
||||||
// Changes status
|
// Change preferred units.
|
||||||
EndToEndTestUtils.SOLO.clickOnText(activityMyTracks
|
EndToEndTestUtils.SOLO.clickOnText(activityMyTracks
|
||||||
.getString(R.string.settings_stats_units_title));
|
.getString(R.string.settings_stats_units_title));
|
||||||
isImperial = !isImperial;
|
isImperial = !isImperial;
|
||||||
@@ -147,7 +144,7 @@ public class SettingTest extends ActivityInstrumentationTestCase2<TrackListActiv
|
|||||||
EndToEndTestUtils.SOLO.clickOnText(activityMyTracks.getString(R.string.track_detail_chart_tab));
|
EndToEndTestUtils.SOLO.clickOnText(activityMyTracks.getString(R.string.track_detail_chart_tab));
|
||||||
instrumentation.waitForIdleSync();
|
instrumentation.waitForIdleSync();
|
||||||
ChartView chartView = EndToEndTestUtils.getChartView();
|
ChartView chartView = EndToEndTestUtils.getChartView();
|
||||||
assertEquals(!isImperial, chartView.metricUnits);
|
assertEquals(!isImperial, chartView.isMetricUnits());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user