Skip to content

Commit

Permalink
Merge pull request #28 from yuancjun/patch-1
Browse files Browse the repository at this point in the history
Fix: The API [GET /uiObject/{oid}/getBounds] returns the view's bounds property.
  • Loading branch information
dtmilano authored Jul 16, 2024
2 parents 44ad0eb + 197f573 commit e491844
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ class UiObject {

fun response(): Rect {
uiObject(oid, objectStore)?.let {
val (top, left, right, bottom) = it.bounds
val (left, top, right, bottom) = it.bounds
return@response Rect(left = left, top = top, right = right, bottom = bottom)
}
throw notFound(oid)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ class KtorApplicationTest {
on { className } doReturn MOCK_CLASS_NAME
on { text } doReturn "Hello Culebra!"
on { contentDescription } doReturn "Hello Culebra content description"
on { bounds } doReturn android.graphics.Rect(100, 100, 600, 900)
on { bounds } doReturn android.graphics.Rect(100, 200, 600, 900)
}

uiObject22 = mock<UiObject2> {
Expand Down Expand Up @@ -1029,8 +1029,8 @@ class KtorApplicationTest {
handleRequest(HttpMethod.Get, "/v2/uiObject/$oid/getBounds").apply {
assertEquals(HttpStatusCode.OK, response.status())
val rect = jsonResponse<Rect>()
assertEquals(100, rect.top)
assertEquals(100, rect.left)
assertEquals(200, rect.top)
assertEquals(600, rect.right)
assertEquals(900, rect.bottom)
}
Expand Down

0 comments on commit e491844

Please sign in to comment.