Skip to content

Commit

Permalink
Release 200924
Browse files Browse the repository at this point in the history
Merged PR 191: Release 200924
  • Loading branch information
joyl1216 authored Sep 25, 2020
2 parents 1e06f27 + 683394b commit 3e419fc
Show file tree
Hide file tree
Showing 128 changed files with 1,065 additions and 994 deletions.
8 changes: 4 additions & 4 deletions CompanionPane/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ android {
buildToolsVersion rootProject.ext.buildToolsVersion

defaultConfig {
applicationId "com.microsoft.device.display.samples.complementarycontext"
applicationId "com.microsoft.device.display.samples.companionpane"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
Expand All @@ -27,15 +27,15 @@ dependencies {
implementation kotlinDependencies.kotlinStdlib
implementation androidxDependencies.appCompat
implementation androidxDependencies.constraintLayout
implementation androidxDependencies.recyclerView
implementation androidxDependencies.cardView
implementation androidxDependencies.viewPager2
implementation androidxDependencies.ktxCore
implementation androidxDependencies.ktxFragment

implementation microsoftDependencies.dualScreenLayout

testImplementation testDependencies.junit

androidTestImplementation instrumentationTestDependencies.junit
androidTestImplementation instrumentationTestDependencies.espressoCore
androidTestImplementation instrumentationTestDependencies.uiAutomator
androidTestImplementation instrumentationTestDependencies.testRules
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*
*/

package com.microsoft.device.display.samples.companionpane

import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.filters.LargeTest
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.rule.ActivityTestRule
import androidx.test.uiautomator.UiDevice
import org.junit.After
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith

@RunWith(AndroidJUnit4ClassRunner::class)
@LargeTest
class LayoutOrientationTest {

private val device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())

@get:Rule
val activityRule = ActivityTestRule<MainActivity>(MainActivity::class.java)

@After
fun resetOrientation() {
device.setOrientationNatural()
device.unfreezeRotation()
}

@Test
fun shouldFindLayout_whenInSinglePortrait() {
onView(withId(R.id.single_screen_container_id)).check(matches(isDisplayed()))
onView(withId(R.id.single_screen_layout_port)).check(matches(isDisplayed()))
}

@Test
fun shouldFindLayout_whenInSingleLandscape() {
rotateDevice()

onView(withId(R.id.single_screen_container_id)).check(matches(isDisplayed()))
onView(withId(R.id.single_screen_layout_land)).check(matches(isDisplayed()))
}

@Test
fun shouldFindLayouts_whenInDoublePortrait() {
spanApplication()

onView(withId(R.id.dual_screen_start_container_id)).check(matches(isDisplayed()))
onView(withId(R.id.picture_dual_layout)).check(matches(isDisplayed()))

onView(withId(R.id.dual_screen_end_container_id)).check(matches(isDisplayed()))
onView(withId(R.id.tools_dual_layout_land)).check(matches(isDisplayed()))
}

@Test
fun shouldFindLayouts_whenInDoubleLandscape() {
spanApplication()
rotateDevice()

onView(withId(R.id.dual_screen_start_container_id)).check(matches(isDisplayed()))
onView(withId(R.id.picture_dual_layout)).check(matches(isDisplayed()))

onView(withId(R.id.dual_screen_end_container_id)).check(matches(isDisplayed()))
onView(withId(R.id.tools_dual_layout_port)).check(matches(isDisplayed()))
}

@Test
fun shouldFindLayouts_whenSpanningInDoubleLandscape() {
rotateDevice()
spanLandscapeApplication()

onView(withId(R.id.dual_screen_start_container_id)).check(matches(isDisplayed()))
onView(withId(R.id.picture_dual_layout)).check(matches(isDisplayed()))

onView(withId(R.id.dual_screen_end_container_id)).check(matches(isDisplayed()))
onView(withId(R.id.tools_dual_layout_port)).check(matches(isDisplayed()))
}

private fun spanApplication() {
device.swipe(675, 1780, 1350, 900, 400)
}

private fun spanLandscapeApplication() {
device.swipe(1780, 2100, 1350, 1500, 400)
}

private fun rotateDevice() {
device.setOrientationLeft()
}
}

This file was deleted.

9 changes: 3 additions & 6 deletions CompanionPane/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,16 @@
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.microsoft.device.display.samples.complementarycontext"
tools:ignore="GoogleAppIndexingWarning">
package="com.microsoft.device.display.samples.companionpane">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="AllowBackup">
<activity android:name=".MainActivity">
android:theme="@style/AppTheme">
<activity android:name="com.microsoft.device.display.samples.companionpane.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
*/

package com.microsoft.device.display.samples.complementarycontextlevel2
package com.microsoft.device.display.samples.companionpane

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 3e419fc

Please sign in to comment.