unoplatform / uno

Open-source platform for building cross-platform native Mobile, Web, Desktop and Embedded apps quickly. Create rich, C#/XAML, single-codebase apps from any IDE. Hot Reload included! 90m+ NuGet Downloads!!
https://platform.uno
Apache License 2.0
8.94k stars 724 forks source link

[Android/WASM] The TextBox_Disable test does not pass #1630

Open jeromelaban opened 5 years ago

jeromelaban commented 5 years ago

Expected behavior

The test passes.

How to reproduce it (as minimally and precisely as possible)

Run this test: https://github.com/unoplatform/uno/blob/59a911c4d1eeecfa709217f2e2b7430aea0251b8/src/SamplesApp/SamplesApp.UITests/UnoSamples_Tests.Keyboard.cs#L391

Environment

Nuget Package:

Package Version(s):

Affected platform(s):

Visual Studio

Relevant plugins

Anything else we need to know?

Infinite AutoRetry for WASM

Youssef1313 commented 3 years ago

I gave a look at this one.

Using the following code:

        private void DisableOnf_BeforeTextChanging(TextBox sender, TextBoxBeforeTextChangingEventArgs args)
        {
            LogTextBlock.Text += $"\nEntered BeforeTextChanging. IsEnabled: {sender.IsEnabled}, NewText: {args.NewText}";
            //if (!sender.IsEnabled)
            //{
            //  args.Cancel = true;
            //}

            if (args.NewText.EndsWith("f"))
            {
                args.Cancel = true;
                sender.IsEnabled = false;
            }

        }

The test still fails, and logs shows the following:

image

This suggests that the commented out condition is always false and is redundant, right?

Hmmm... Uncomment it, now the test passes. @MartinZikmund Any guess on what can be going here? I don't like adding such a seemingly redundant check to close the issue. Feels very hacky and this might be effectively "hiding" some bug elsewhere.

Note that in the screenshot, the text became "Catish" while DisableOnf_BeforeTextChanging was never called with such text.

jeromelaban commented 3 years ago

This feels like the even is raised incorrectly, indeed. What does lead to that event being raised in the wrong conditions?