diff --git a/api/@ohos.uitest.d.ts b/api/@ohos.uitest.d.ts index 1e88f91157c86dc99a2bf1900c955b8ad158a04f..c29c5450692d3eac5a082dc8da98b4e5a0b5cd49 100644 --- a/api/@ohos.uitest.d.ts +++ b/api/@ohos.uitest.d.ts @@ -75,6 +75,18 @@ SECONDARY, FLOATING } + +/** + * Describes the rotation of the device display + * @syscap SystemCapability.Test.UiTest + * @since 9 + */ +enum DisplayRotation { + ROTATION_0, + ROTATION_90, + ROTATION_180, + ROTATION_270 +} /** * Represents the point on the device screen. @@ -675,6 +687,101 @@ class UiComponent{ * @test */ screenCap(savePath:string):Promise; + + /** + * Set the rotation of the device display. + * @syscap SystemCapability.Test.UiTest + * @param rotation the target rotation to set. + * @since 9 + * @test + */ + setDisplayRotation(rotation: DisplayRotation):Promise; + + /** + * Get the rotation of the device display. + * @syscap SystemCapability.Test.UiTest + * @returns the current display rotation. + * @since 9 + * @test + */ + getDisplayRotation():Promise; + + /** + * Enable/disable the rotation of device display. + * @syscap SystemCapability.Test.UiTest + * @param enabled enable the rotation or not. + * @since 9 + * @test + */ + setDisplayRotationEnabled(enabled:bool):Promise; + + /** + * Get the size of the device display. + * @syscap SystemCapability.Test.UiTest + * @returns the size of the device display. + * @since 9 + * @test + */ + getDisplaySize():Promise; + + /** + * Get the density of the device display. + * @syscap SystemCapability.Test.UiTest + * @returns the density of the device display. + * @since 9 + * @test + */ + getDisplayDensity():Promise; + + /** + * Wake up the device display. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + wakeUpDisplay():Promise; + + /** + * Press the home key. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + pressHome():Promise; + + /** + * Wait for the UI become idle. + * @syscap SystemCapability.Test.UiTest + * @param idleTime the threshold of UI idle time, in millisecond. + * @param timeout the maximum time to wait for idle, in millisecond. + * @returns true if wait for idle succeed in the timeout, false otherwise. + * @since 9 + * @test + */ + waitForIdle(idleTime: number, timeout: number):Promise; + + /** + * Inject fling on the device display. + * @syscap SystemCapability.Test.UiTest + * @param from the threshold of UI idle time, in millisecond. + * @param to the maximum time to wait for idle, in millisecond. + * @param stepLen the length of each step, in pixels. + * @param speed the speed of fling (pixels per second),default is 600,the value ranges from 0 to 3000,set it 3000 if greater than 3000. + * @returns true if wait for idle succeed in the timeout, false otherwise. + * @since 9 + * @test + */ + fling(from: Point, to: Point, stepLen: number, speed: number):Promise; + + /** + * Inject multi-pointer action on the device display. + * @syscap SystemCapability.Test.UiTest + * @param pointers the two-dimensional array of pointers to inject. + * @param speed the speed of swipe (pixels per second),default is 600,the value ranges from 0 to 3000,set it 3000 if greater than 3000. + * @since 9 + * @test + */ + injectMultiPointerAction(pointers: PointerMatrix, speed?: number):Promise; } /** @@ -812,6 +919,37 @@ class UiComponent{ close():Promise; } +/** + * Represents a two-dimensional array of pointers on the device display, it's used to build a + * multi-finger trace which can be injected with UiDriver. + * + * @since 9 + * @test + * @syscap SystemCapability.Test.UiTest + */ +class PointerMatrix { + /** + * Create an {@link PointerMatrix} object. + * @syscap SystemCapability.Test.UiTest + * @param fingers the number of fingers. + * @param steps the number of steps of each finger trace. + * @returns the {@link PointerMatrix} object. + * @since 9 + * @test + */ + static create(fingers: number, steps: number):PointerMatrix; + + /** + * Set the point value of an element in the PointerMatrix. + * @syscap SystemCapability.Test.UiTest + * @param finger the index of target finger to set. + * @param step the index of target step to set. + * @since 9 + * @test + */ + setPoint(finger: number, step: number, point: Point):void; +} + /** * The static builder for building {@link By}object conveniently,usage example:BY.text('txt').enabled(true). * @syscap SystemCapability.Test.UiTest