Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test that text input is entered after child window is closed #216

Merged
merged 9 commits into from
May 15, 2023

Conversation

wmww
Copy link
Contributor

@wmww wmww commented Nov 12, 2021

This is supposed to test canonical/mir#2189, but it passes for some reason. A problem for next week.

@wmww
Copy link
Contributor Author

wmww commented Nov 15, 2021

Ah! I forgot to actually set the parent on the child. Fixed. (and by fixed, I mean the test is now failing as it should)

@wmww
Copy link
Contributor Author

wmww commented Nov 16, 2021

canonical/mir#2223 fixes this test on Mir.

@wmww wmww marked this pull request as ready for review December 7, 2021 17:06
bors bot added a commit to canonical/mir that referenced this pull request Dec 8, 2021
2244: Give keyboard focus to menus (grabbing popups) r=Saviq a=wmww

According to XDG Shell, grabbing popups should be given keyboard focus and non-grabbing ones should not. This PR brings our keyboard focus logic in line with that.

Fixes #2241. Tested by the recently-updated canonical/wlcs#216.

Co-authored-by: William Wold <wm@wmww.sh>
Co-authored-by: Alan Griffiths <alan@octopull.co.uk>
AlanGriffiths added a commit to canonical/mir that referenced this pull request Dec 8, 2021
2244: Give keyboard focus to menus (grabbing popups) r=Saviq a=wmww

According to XDG Shell, grabbing popups should be given keyboard focus and non-grabbing ones should not. This PR brings our keyboard focus logic in line with that.

Fixes #2241. Tested by the recently-updated canonical/wlcs#216.

Co-authored-by: William Wold <wm@wmww.sh>
Co-authored-by: Alan Griffiths <alan@octopull.co.uk>
AlanGriffiths added a commit to canonical/mir that referenced this pull request Dec 10, 2021
* Release 2.6.0 & changelog

* gbm-kms: Be more relaxed in the rendering probe. (#2243)

The libmali EGL implementation requires that the `gbm_device` passed in to
`eglGetPlatformDisplay` be created from a DRM master fd.

We can't guarantee this in the rendering probe, as the display platform may
have already claimed DRM master.

Instead, assume that an EGL platform which claims to support the GBM platform
will be at least minimally usable with GBM.

(cherry picked from commit 316b40d)

* Merge #2244

2244: Give keyboard focus to menus (grabbing popups) r=Saviq a=wmww

According to XDG Shell, grabbing popups should be given keyboard focus and non-grabbing ones should not. This PR brings our keyboard focus logic in line with that.

Fixes #2241. Tested by the recently-updated canonical/wlcs#216.

Co-authored-by: William Wold <wm@wmww.sh>
Co-authored-by: Alan Griffiths <alan@octopull.co.uk>

Co-authored-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
Co-authored-by: bors[bot] <26634292+bors[bot]@users.noreply.github.com>
Co-authored-by: William Wold <wm@wmww.sh>
Copy link
Contributor

@RAOF RAOF left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops! Looks like I left a review pending 😬

One non-blocking stylistic thing wrt operator wl_surface*(), one question about what we're testing that might require changes.

TEST_F(TextInputV3WithInputMethodV2Test, text_input_does_not_enter_non_grabbing_popup)
{
auto parent_surface = std::make_unique<wlcs::Surface>(app_client);
EXPECT_CALL(text_input, enter(parent_surface->operator wl_surface*()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason this isn't EXPECT_CALL(text_input, enter(static_cast<wl_surface*>(*parent_surface)))? That would seem more natural to me.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Presumably the static_cast is necessary? Will *parent_surface implicitly-coerce into wl_surface* via operator wl_surface*()?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do believe some sort of explicit conversion is necessary. I, personally, like the explicit call to operator. Is there any reason to prefer static cast?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I, personally, like the explicit call to operator.

I, personally, find it strange to invoke operators by calling the operator function by name. The point of such functions is that they can be invoked using operator syntax.

If the intended use is to call the function by name then there are better names.

I'd be tempted to introduce a helper function:

auto as_wl_surface(auto const& s) -> wl_surface*
{
    return s;
}
Suggested change
EXPECT_CALL(text_input, enter(parent_surface->operator wl_surface*()));
EXPECT_CALL(text_input, enter(as_wl_surface((*parent_surface)));

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the latest update satisfactory?

Comment on lines 188 to 189
EXPECT_CALL(text_input, leave(parent_surface->operator wl_surface*())).Times(0);
EXPECT_CALL(text_input, enter(child_surface->operator wl_surface*())).Times(0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these should EXPECT_CALL leave(_) and enter(_)? We want to assert that the non-grabbing popup doesn't change the test_input state, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@wmww wmww force-pushed the text-input-child-window-closed branch from 426d84b to 605bba9 Compare May 8, 2023 17:00
@wmww
Copy link
Contributor Author

wmww commented May 8, 2023

Ready for review

Copy link
Contributor

@RAOF RAOF left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of nits, but this can land.

Feel free to fix them up, or not.

(I think the workflow for this now is just to approve and then let Sophie hit the “merge” button?)

Comment on lines +257 to +258
EXPECT_CALL(text_input, leave(parent_surface->wl_surface()));
EXPECT_CALL(text_input, enter(child_surface->wl_surface()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking, but this ordering is a protocol requirement, so we should probably enforce it.

EXPECT_CALL(text_input, leave(_)).Times(0);
EXPECT_CALL(text_input, enter(_)).Times(0);
auto child_xdg_surface = std::make_shared<wlcs::XdgSurfaceStable>(app_client, *child_surface);
auto child_xdg_toplevel = std::make_shared<wlcs::XdgPopupStable>(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: child_xdg_toplevel -> child_xdg_popup

@Saviq
Copy link
Collaborator

Saviq commented May 15, 2023

(I think the workflow for this now is just to approve and then let Sophie hit the “merge” button?)

Not before #289 :)

@wmww wmww added this pull request to the merge queue May 15, 2023
Merged via the queue into main with commit 40d4fe8 May 15, 2023
12 checks passed
@wmww wmww deleted the text-input-child-window-closed branch May 15, 2023 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants