(self, x, y, direction, dist="medium", quick=False)
| 152 | return ret |
| 153 | |
| 154 | def swipe(self, x, y, direction, dist="medium", quick=False): |
| 155 | unit_dist = int(self.width / 10) |
| 156 | if dist == "long": |
| 157 | unit_dist *= 3 |
| 158 | elif dist == "medium": |
| 159 | unit_dist *= 2 |
| 160 | if direction == "up": |
| 161 | offset = 0, -2 * unit_dist |
| 162 | elif direction == "down": |
| 163 | offset = 0, 2 * unit_dist |
| 164 | elif direction == "left": |
| 165 | offset = -1 * unit_dist, 0 |
| 166 | elif direction == "right": |
| 167 | offset = unit_dist, 0 |
| 168 | else: |
| 169 | return "ERROR" |
| 170 | duration = 100 if quick else 400 |
| 171 | adb_command = f"adb -s {self.device} shell input swipe {x} {y} {x+offset[0]} {y+offset[1]} {duration}" |
| 172 | ret = execute_adb(adb_command) |
| 173 | return ret |
| 174 | |
| 175 | def swipe_precise(self, start, end, duration=400): |
| 176 | start_x, start_y = start |
no test coverage detected