Skip to content

Commit

Permalink
Code clean
Browse files Browse the repository at this point in the history
  • Loading branch information
max-kammerer committed Apr 8, 2024
1 parent d154a70 commit d9f1349
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ class RotationTest : BaseViewerActivityTest(BookDescription.SICP) {
device.waitForIdle()

try {
var newOrientation: Int = Int.MAX_VALUE
onActivity {
newOrientation = it.resources!!.configuration.orientation
val newOrientation = onActivity {
it.resources!!.configuration.orientation
}

checkNotEquals("Orientation not changed: $orientation", orientation, newOrientation)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
package universe.constellation.orion.viewer.test.espresso.contenturi

import android.os.Build
import android.widget.Button
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.action.ViewActions.click
import androidx.test.espresso.assertion.ViewAssertions
import androidx.test.espresso.matcher.ViewMatchers
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
import androidx.test.espresso.matcher.ViewMatchers.withSubstring
import androidx.test.filters.SdkSuppress
import org.hamcrest.core.AllOf.allOf
import org.hamcrest.core.IsNot.not
import org.junit.Ignore
import org.junit.Test
import universe.constellation.orion.viewer.R
import universe.constellation.orion.viewer.test.framework.BaseTestWithActivity
import universe.constellation.orion.viewer.test.framework.createContentIntentWithGenerated

Expand All @@ -28,39 +25,16 @@ class InvalidContentProviderTest : BaseTestWithActivity(createContentIntentWithG

}

@SdkSuppress(minSdkVersion = Build.VERSION_CODES.KITKAT)
class InvalidContentProvider2Test : BaseTestWithActivity(createContentIntentWithGenerated("secondTime.error2.pdf")) {

@Test
fun openViaTemporaryFile() {
onView(
allOf(withSubstring("temporary"),
not(ViewMatchers.isAssignableFrom(Button::class.java))
)
).perform(click())

onView(withSubstring("targetFile")).check(ViewAssertions.matches(isDisplayed()))
onView(withSubstring("GitHub")).check(ViewAssertions.matches(isDisplayed()))
onView(withSubstring("E-Mail")).check(ViewAssertions.matches(isDisplayed()))
}

}

@Ignore
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.KITKAT)
class InvalidContentProvider3Test : BaseTestWithActivity(createContentIntentWithGenerated("secondTime.error2.pdf")) {
class InvalidContentProvider2Test : BaseTestWithActivity(createContentIntentWithGenerated("secondTime.error2.pdf")) {

@Test
fun openViaTemporaryFile() {
onView(
allOf(withSubstring("Save"),
not(ViewMatchers.isAssignableFrom(Button::class.java))
)
).perform(click())
onTextNotButtonView(R.string.fileopen_save_to_file).perform(click())

onView(withSubstring("targetFile")).check(ViewAssertions.matches(isDisplayed()))
onView(withSubstring("GitHub")).check(ViewAssertions.matches(isDisplayed()))
onView(withSubstring("E-Mail")).check(ViewAssertions.matches(isDisplayed()))
}

}

0 comments on commit d9f1349

Please sign in to comment.