|
63 | 63 | import static androidx.test.espresso.matcher.ViewMatchers.isChecked; |
64 | 64 | import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed; |
65 | 65 | import static androidx.test.espresso.matcher.ViewMatchers.isEnabled; |
| 66 | +import static androidx.test.espresso.matcher.ViewMatchers.isNotChecked; |
66 | 67 | import static androidx.test.espresso.matcher.ViewMatchers.withId; |
67 | 68 | import static androidx.test.espresso.matcher.ViewMatchers.withText; |
68 | 69 |
|
@@ -129,7 +130,74 @@ public void testSelectWholeScript() { |
129 | 130 | .check(matches(not(isChecked()))); |
130 | 131 | } |
131 | 132 | } |
| 133 | + @Test |
| 134 | + public void testSelectWholeScriptByClickingOnTheBrick() { |
| 135 | + openContextualActionModeOverflowMenu(); |
| 136 | + onView(withText(R.string.copy)).perform(click()); |
| 137 | + |
| 138 | + int brickIndex = 0; |
| 139 | + onBrickAtPosition(brickIndex).performClick(); |
132 | 140 |
|
| 141 | + getCheckbox(brickIndex).check(matches(isChecked())); |
| 142 | + |
| 143 | + for (brickIndex++; brickIndex <= firstScriptEndIndex; brickIndex++) { |
| 144 | + getCheckbox(brickIndex) |
| 145 | + .check(matches(not(isEnabled()))) |
| 146 | + .check(matches(isChecked())); |
| 147 | + } |
| 148 | + for (; brickIndex <= secondScriptEndIndex; brickIndex++) { |
| 149 | + getCheckbox(brickIndex) |
| 150 | + .check(matches(not(isEnabled()))) |
| 151 | + .check(matches(not(isChecked()))); |
| 152 | + } |
| 153 | + } |
| 154 | + @Test |
| 155 | + public void testIfCheckboxSetAfterClickingOnBrick() { |
| 156 | + openContextualActionModeOverflowMenu(); |
| 157 | + onView(withText(R.string.copy)).perform(click()); |
| 158 | + |
| 159 | + int brickIndex = 0; |
| 160 | + onBrickAtPosition(brickIndex).performClick(); |
| 161 | + getCheckbox(brickIndex).check(matches(isChecked())); |
| 162 | + onBrickAtPosition(brickIndex).performClick(); |
| 163 | + getCheckbox(brickIndex).check(matches(isNotChecked())); |
| 164 | + |
| 165 | + for (++brickIndex; brickIndex <= firstScriptEndIndex; brickIndex++) { |
| 166 | + if (brickIndex == 3) { |
| 167 | + onBrickAtPosition(brickIndex).performClick(); |
| 168 | + getCheckbox(brickIndex).check(matches(isChecked())); |
| 169 | + onBrickAtPosition(brickIndex - 2).performClick(); |
| 170 | + getCheckbox(brickIndex).check(matches(isNotChecked())); |
| 171 | + continue; |
| 172 | + } |
| 173 | + onBrickAtPosition(brickIndex).performClick(); |
| 174 | + getCheckbox(brickIndex).check(matches(isChecked())); |
| 175 | + onBrickAtPosition(brickIndex).performClick(); |
| 176 | + getCheckbox(brickIndex).check(matches(isNotChecked())); |
| 177 | + } |
| 178 | + } |
| 179 | + @Test |
| 180 | + public void testIfDisabledBricksNotClickable() { |
| 181 | + openContextualActionModeOverflowMenu(); |
| 182 | + onView(withText(R.string.copy)).perform(click()); |
| 183 | + |
| 184 | + int brickIndex = 0; |
| 185 | + onBrickAtPosition(brickIndex).performClick(); |
| 186 | + |
| 187 | + getCheckbox(brickIndex).check(matches(isChecked())); |
| 188 | + |
| 189 | + for (++brickIndex; brickIndex <= firstScriptEndIndex; brickIndex++) { |
| 190 | + getCheckbox(brickIndex).check(matches(not(isEnabled()))) |
| 191 | + .check(matches(isChecked())); |
| 192 | + } |
| 193 | + |
| 194 | + brickIndex = 0; |
| 195 | + for (++brickIndex; brickIndex <= firstScriptEndIndex; brickIndex++) { |
| 196 | + onBrickAtPosition(brickIndex).performClick(); |
| 197 | + getCheckbox(brickIndex).check(matches(not(isEnabled()))) |
| 198 | + .check(matches(isChecked())); |
| 199 | + } |
| 200 | + } |
133 | 201 | @Test |
134 | 202 | public void testSelectSingleBrick() { |
135 | 203 | openContextualActionModeOverflowMenu(); |
|
0 commit comments