diff --git a/MyTracksTest_E2E/src/com/google/android/apps/mytracks/endtoendtest/common/ViewsTest.java b/MyTracksTest_E2E/src/com/google/android/apps/mytracks/endtoendtest/common/ViewsTest.java index c3a130f1b..5b1bb3d83 100644 --- a/MyTracksTest_E2E/src/com/google/android/apps/mytracks/endtoendtest/common/ViewsTest.java +++ b/MyTracksTest_E2E/src/com/google/android/apps/mytracks/endtoendtest/common/ViewsTest.java @@ -13,22 +13,21 @@ * License for the specific language governing permissions and limitations under * the License. */ + package com.google.android.apps.mytracks.endtoendtest.common; +import com.google.android.apps.mytracks.TrackDetailActivity; import com.google.android.apps.mytracks.TrackListActivity; import com.google.android.apps.mytracks.endtoendtest.EndToEndTestUtils; +import com.google.android.apps.mytracks.fragments.ChartFragment; import com.google.android.apps.mytracks.fragments.MyTracksMapFragment; +import com.google.android.apps.mytracks.fragments.StatsFragment; import com.google.android.maps.mytracks.R; -import android.annotation.SuppressLint; import android.app.Instrumentation; -import android.graphics.Point; -import android.os.Build; import android.test.ActivityInstrumentationTestCase2; -import android.util.Log; import android.view.Display; import android.view.View; -import android.widget.TextView; import junit.framework.Assert; @@ -39,9 +38,8 @@ import junit.framework.Assert; */ public class ViewsTest extends ActivityInstrumentationTestCase2 { - private static final String TAG = ViewsTest.class.getSimpleName(); private Instrumentation instrumentation; - private TrackListActivity activityMyTracks; + private TrackListActivity trackListActivity; public ViewsTest() { super(TrackListActivity.class); @@ -51,132 +49,8 @@ public class ViewsTest extends ActivityInstrumentationTestCase2= 13) { - display.getSize(size); - } else { - size.x = display.getWidth(); - size.y = display.getHeight(); - } - int width = size.x; - int height = size.y; - - Log.d(TAG, width + ":" + height); - - // In landscape view - if (width > height) { - Assert.assertTrue(controller.getWidth() < controller.getHeight()); - Assert.assertTrue(controller.getTop() < height / 2); - Assert.assertTrue(controller.getRight() < width / 2); - } - - // In portrait view - else { - Assert.assertTrue(controller.getWidth() > controller.getHeight()); - Log.d(TAG, controller.getTop() + ":" + controller.getRight()); - - Assert.assertTrue(controller.getTop() > height / 2); - Assert.assertTrue(controller.getRight() > width / 2); - } + trackListActivity = getActivity(); + EndToEndTestUtils.setupForAllTest(instrumentation, trackListActivity); } @Override @@ -185,4 +59,123 @@ public class ViewsTest extends ActivityInstrumentationTestCase2 height) { + // In landscape view + Assert.assertTrue(controller.getWidth() < controller.getHeight()); + Assert.assertTrue(controller.getTop() < height / 2); + Assert.assertTrue(controller.getRight() < width / 2); + } else { + // In portrait view + Assert.assertTrue(controller.getWidth() > controller.getHeight()); + Assert.assertTrue(controller.getTop() > height / 2); + Assert.assertTrue(controller.getRight() > width / 2); + } + } } \ No newline at end of file