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

Fix input text cursor movement tests #9

Closed
wants to merge 1 commit into from
Closed

Fix input text cursor movement tests #9

wants to merge 1 commit into from

Conversation

ajweeks
Copy link
Contributor

@ajweeks ajweeks commented Jan 29, 2023

Unblocks imgui/pull/6067

This change fixes a couple of bugs in the input text tests, and changes the ifdef checks to check against a version number (which may be the incorrect one once the PR in the main repo is merged). I'm also not confident that these tests will pass with older version of ImGui due to not being able to test them, though if they worked before then they still should now.

Unblocks imgui/pull/6067
IM_CHECK_EQ(state->GetCursorPos(), 6 + 5); // "Hello world|. Foo.bar!!!" // VS-Win: STOP, GitHubWeb-Win: SKIP
KeyPressAndDebugPrint(chord_word_prev);
#endif
IM_CHECK_EQ(state->GetCursorPos(), 6); // "Hello |world. Foo.bar!!!"

KeyPressAndDebugPrint(chord_word_prev);
IM_CHECK_EQ(state->GetCursorPos(), 0); // "|Hello world. Foo.bar!!!"

KeyPressAndDebugPrint(chord_word_prev);
IM_CHECK_EQ(state->GetCursorPos(), 0); // "|Hello world. Foo.bar!!!" // (no-op)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if this functionality is tested elsewhere and this test is useless or not.

}
else
{
// OSX
KeyPressAndDebugPrint(chord_word_next);
IM_CHECK_EQ(state->GetCursorPos(), 5); // "Hello|"
ImGui::SetActiveID(state->ID, ImGui::GetCurrentWindow());
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These lines were necessary for me to test on Windows since the Alt keypress will change the focus to the dropdown arrow, causing the next keypress to not be registered by the inputtext widget. Of course a more robust solution is needed but I couldn't find one quickly.

Copy link
Owner

Choose a reason for hiding this comment

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

That part was actually a bug on OSX which was fixed by fc50532 around the time you made that PR, so I'm removing those lines now.

ocornut pushed a commit that referenced this pull request Mar 22, 2023
…in order to support separator changes (#9)

Main repo: Unblocks imgui/pull/6067
@ocornut
Copy link
Owner

ocornut commented Mar 22, 2023

Merged as cc40e07, thank you!

@ocornut ocornut closed this Mar 22, 2023
@ajweeks ajweeks deleted the fix-inputtext-tests branch March 26, 2023 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants