-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathImageEditingTest.kt
More file actions
92 lines (69 loc) · 2.23 KB
/
Copy pathImageEditingTest.kt
File metadata and controls
92 lines (69 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package com.example.photoeditor
// ✅ Required Imports (VERY IMPORTANT)
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.ext.junit.rules.ActivityScenarioRule
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.Espresso.onData
import androidx.test.espresso.action.ViewActions.*
import androidx.test.espresso.matcher.ViewMatchers.*
import androidx.test.espresso.assertion.ViewAssertions.matches
import org.hamcrest.Matchers.anything
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
class ImageEditingTest {
@Rule
@JvmField
val activityRule = ActivityScenarioRule(MainActivity::class.java)
@Test
fun testRotateImage() {
onView(withId(R.id.btnRotate))
.check(matches(isDisplayed()))
.perform(click())
onView(withId(R.id.imageView))
.check(matches(isDisplayed()))
}
@Test
fun testFlipImage() {
onView(withId(R.id.btnFlip))
.check(matches(isDisplayed()))
.perform(click())
onView(withId(R.id.imageView))
.check(matches(isDisplayed()))
}
@Test
fun testIncreaseBrightness() {
onView(withId(R.id.seekBarBrightness))
.check(matches(isDisplayed()))
.perform(click())
onView(withId(R.id.imageView))
.check(matches(isDisplayed()))
}
@Test
fun testDecreaseBrightness() {
onView(withId(R.id.seekBarBrightness))
.perform(click())
onView(withId(R.id.imageView))
.check(matches(isDisplayed()))
}
@Test
fun testSelectFilter() {
onView(withId(R.id.spinnerFilters))
.check(matches(isDisplayed()))
.perform(click())
// Select first item from spinner
onData(anything()).atPosition(0).perform(click())
onView(withId(R.id.imageView))
.check(matches(isDisplayed()))
}
@Test
fun testFilterButton() {
onView(withId(R.id.btnFilter))
.check(matches(isDisplayed()))
.perform(click())
// App should not crash
onView(withId(R.id.imageView))
.check(matches(isDisplayed()))
}
}