Skip to content

Commit

Permalink
scale: redo the test to avoid assuming resolution
Browse files Browse the repository at this point in the history
Also drop "fractional", it's not only testing that.
  • Loading branch information
Saviq authored and tarek-y-ismail committed Aug 21, 2024
1 parent 2422096 commit 31dbc8a
Show file tree
Hide file tree
Showing 39 changed files with 71 additions and 85 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions mir-ci/mir_ci/tests/robot/suites/scale/scale.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
*** Settings ***
Resource ${KVM_RESOURCE}

Suite Setup Suite Setup
Test Setup Set Output Scale ${SCALE}


*** Variables ***
${T} ${CURDIR}
${SCREENSHOT} ${T}/${SCALE}-gtk4-demo-screenshot.png
${DEMO-APP-TITLE} ${T}/${SCALE}-gtk4-demo-title-main.png
${DEMO-APP-TITLE-HALF} ${T}/${SCALE}-gtk4-demo-title-main-half.png
${BUTTON} ${T}/${SCALE}-gtk4-demo-button.png
${TITLE} ${T}/${SCALE}-gtk4-demo-title.png


*** Test Cases ***
Ensure Scaling Is Visually Correct
Move Pointer To Proportional (1.0, 1.0)

Match ${SCREENSHOT}

Click Button With Scaling Enabled
Walk Pointer To ${BUTTON}
Click LEFT Button

Match ${TITLE}


*** Keywords ***
Suite Setup
Set Output Scale ${SCALE}
# Work around https://github.com/canonical/mir/issues/3553
${aligned}= Run Keyword And Return Status
... Walk Pointer To ${DEMO-APP-TITLE}
IF ${aligned} == False Walk Pointer To ${DEMO-APP-TITLE-HALF}
Click LEFT Button
Click LEFT Button
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def collect_assets(platform: str, resources: Collection[str], suite: str, varian
},
)
@pytest.mark.env(GSETTINGS_BACKEND="keyfile")
@pytest.mark.parametrize("server", servers(ServerCap.FLOATING_WINDOWS | ServerCap.DISPLAY_CONFIG))
@pytest.mark.parametrize("server", servers(ServerCap.DISPLAY_CONFIG))
@pytest.mark.parametrize("scale", [1.0, 1.5, 2.0])
@pytest.mark.deps(
debs=("gtk-4-examples",),
Expand All @@ -62,16 +62,17 @@ def collect_assets(platform: str, resources: Collection[str], suite: str, varian
("rpaframework-recognition", "RPA.recognition"),
),
)
class TestFractionalScaleV1:
async def test_fractional_scale_v1(self, robot_log, server, scale, tmp_path) -> None:
extensions = ("all",) # TODO no need to enable all extensions
class TestScale:
async def test_scale(self, robot_log, server, scale, tmp_path) -> None:
extensions = ("all",) # TODO no need to enable all extension

server_instance = DisplayServer(
server,
add_extensions=extensions,
env={"MIR_SERVER_X11_OUTPUT": "1024x768", "MIR_SERVER_DISPLAY_SCALE": str(scale)},
)

assets = collect_assets("wayland", ["kvm"], "fractional_scale_v1")
assets = collect_assets("wayland", ["kvm"], "scale")

async with server_instance, server_instance.program(App(APP_PATH, AppType.deb)):
tuple((tmp_path / k).symlink_to(v) for k, v in assets.items())
Expand Down

0 comments on commit 31dbc8a

Please sign in to comment.