-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ac65b1a
commit 4353828
Showing
12 changed files
with
128 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 2 additions & 8 deletions
10
orion-viewer/src/androidTest/kotlin/universe/constellation/orion/viewer/test/RotationTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
...est/kotlin/universe/constellation/orion/viewer/test/espresso/CheckTapZoneWelcomeScreen.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package universe.constellation.orion.viewer.test.espresso | ||
|
||
import android.content.Intent | ||
import androidx.test.espresso.Espresso.* | ||
import androidx.test.espresso.action.ViewActions | ||
import androidx.test.espresso.assertion.ViewAssertions.doesNotExist | ||
import androidx.test.espresso.assertion.ViewAssertions.matches | ||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed | ||
import androidx.test.espresso.matcher.ViewMatchers.withId | ||
import androidx.test.ext.junit.rules.activityScenarioRule | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
import androidx.test.platform.app.InstrumentationRegistry | ||
import org.hamcrest.Matchers.* | ||
import org.junit.Assert.assertFalse | ||
import org.junit.Assert.assertTrue | ||
import org.junit.Rule | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import universe.constellation.orion.viewer.OrionViewerActivity | ||
import universe.constellation.orion.viewer.R | ||
import universe.constellation.orion.viewer.prefs.GlobalOptions | ||
import universe.constellation.orion.viewer.prefs.OrionApplication | ||
import universe.constellation.orion.viewer.test.framework.BookDescription | ||
import universe.constellation.orion.viewer.test.framework.InstrumentationTestCase | ||
|
||
abstract class CheckTapZoneWelcomeScreen(private val showTapHelp: Boolean, intent: Intent) : InstrumentationTestCase() { | ||
|
||
@get:Rule | ||
var activityScenarioRule = activityScenarioRule<OrionViewerActivity>(intent.apply { | ||
if (showTapHelp) { | ||
putExtra(GlobalOptions.SHOW_TAP_HELP, true) | ||
} else { | ||
putExtra(GlobalOptions.SHOW_TAP_HELP, false) | ||
} | ||
}) | ||
|
||
} | ||
@RunWith(AndroidJUnit4::class) | ||
class NoBookNoWelcome: CheckTapZoneWelcomeScreen(true, BookDescription.SICP.toOpenIntent().apply { data = null;}) { | ||
@Test | ||
fun testWelcome() { | ||
val options = | ||
(InstrumentationRegistry.getInstrumentation().targetContext.applicationContext as OrionApplication).options | ||
onView(withId(R.id.tap_help_close)).check(doesNotExist()) | ||
assertTrue(options.isShowTapHelp) | ||
} | ||
} | ||
|
||
@RunWith(AndroidJUnit4::class) | ||
class BookWithWelcome: CheckTapZoneWelcomeScreen(true, BookDescription.SICP.toOpenIntent()) { | ||
@Test | ||
fun testWelcome() { | ||
val options = | ||
(InstrumentationRegistry.getInstrumentation().targetContext.applicationContext as OrionApplication).options | ||
assertTrue(options.isShowTapHelp) | ||
onView(withId(R.id.tap_help_close)).check(matches(isDisplayed())) | ||
onView(withId(R.id.tap_help_close)).perform(ViewActions.click()) | ||
onView(withId(R.id.tap_help_close)).check(matches(isDisplayed())) | ||
onView(withId(R.id.tap_help_close)).check(doesNotExist()) | ||
// | ||
// assertFalse(options.isShowTapHelp) | ||
|
||
} | ||
} |
11 changes: 0 additions & 11 deletions
11
...wer/src/androidTest/kotlin/universe/constellation/orion/viewer/test/framework/BaseTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,12 @@ | ||
package universe.constellation.orion.viewer.test.framework | ||
|
||
import android.content.Context | ||
import androidx.test.platform.app.InstrumentationRegistry | ||
import androidx.test.rule.GrantPermissionRule | ||
import org.junit.Rule | ||
|
||
/** | ||
* User: mike | ||
* Date: 19.10.13 | ||
* Time: 13:45 | ||
*/ | ||
abstract class BaseTest : TestUtil { | ||
|
||
@Rule | ||
@JvmField | ||
val mRuntimePermissionRule: GrantPermissionRule = GrantPermissionRule.grant(android.Manifest.permission.WRITE_EXTERNAL_STORAGE, android.Manifest.permission.READ_EXTERNAL_STORAGE) | ||
|
||
override fun getOrionTestContext(): Context { | ||
return InstrumentationRegistry.getInstrumentation().targetContext | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters