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 regressions with NumberBox HeaderPresenter behavior #2148

Merged
merged 12 commits into from
Apr 28, 2020

Conversation

marcelwgn
Copy link
Collaborator

Description

Fixes the following regressions:

  • Initially specified header did not render
  • HeaderTemplate did not work
  • Lazy loading was not used

Motivation and Context

Fixes the regressions listed above as mentioned in these comments

How Has This Been Tested?

Add new interaction tests

Screenshots (if appropriate):

@msft-github-bot msft-github-bot added the needs-triage Issue needs to be triaged by the area owners label Mar 23, 2020
marcelwgn referenced this pull request Mar 23, 2020
* Fix issue with header taking up space when not specified/null

* Add NumberBox header test

* Add log comments for test

* Fix behavior of empty string

* Update test
@ranjeshj ranjeshj requested a review from teaP March 23, 2020 13:22
@ranjeshj ranjeshj added area-NumberBox NumberBox Control team-Controls Issue for the Controls team and removed needs-triage Issue needs to be triaged by the area owners labels Mar 23, 2020
@StephenLPeters
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ranjeshj
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@StephenLPeters
Copy link
Contributor

@chingucoding the latest test pass has all the numberbox tests timing out. if you look at the log in the artifacts it looks like all the tests are failing due to a null ref exception and getting so many retries that the work item times out.

@marcelwgn
Copy link
Collaborator Author

@chingucoding the latest test pass has all the numberbox tests timing out. if you look at the log in the artifacts it looks like all the tests are failing due to a null ref exception and getting so many retries that the work item times out.

Yeah somehow setting the UIA name of the header of the "TestNumberBox" broke those tests. Reverted it, so it should work now.

@StephenLPeters
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@Kinnara
Copy link
Contributor

Kinnara commented Mar 25, 2020

Currently the logic to determine header visibility is duplicated in both OnApplyTemplate and UpdateHeaderPresenterState. What about doing something like below to consolidate them?

void OnApplyTemplate()
{
    ...
    m_headerPresenter = null; // In case the control template was changed
    UpdateHeaderPresenterState();
    ...
}

void UpdateHeaderPresenterState()
{
    bool showHeader;
    
    if (HeaderTemplate != null)
    {
        showHeader = true;
    }
    else
    {
        var header = Header;
        showHeader = header != null && (header is not empty string);
    }
    
    if (showHeader && m_headerPresenter == null)
    {
        m_headerPresenter = GetTemplateChild(...);
    }
    
    if (m_headerPresenter != null)
    {
        m_headerPresenter.Visibility = showHeader ? Visibility.Visible : Visibility.Collapsed;
    }
}

@marcelwgn
Copy link
Collaborator Author

@Kinnara That's a great idea! I've updated the code.

@ranjeshj
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@StephenLPeters
Copy link
Contributor

hmm @chingucoding looks like a test got broken down level

@ranjeshj
Copy link
Contributor

ranjeshj commented Apr 1, 2020

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ranjeshj
Copy link
Contributor

ranjeshj commented Apr 3, 2020

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@StephenLPeters
Copy link
Contributor

            InputHelper.RotateWheel(numBoxInScrollViewer, 1);

I'm trying to devine your downlevel issue, without actually debugging, it. I wonder if the mouse wheel input is missing numBox, unfortunately I can't look at what this helper actually does.. maybe you could try to treewalk into a part and mouse wheel on that instead. =/


Refers to: dev/NumberBox/InteractionTests/NumberBoxTests.cs:335 in e64dc76. [](commit_id = e64dc76, deletion_comment = False)

@marcelwgn
Copy link
Collaborator Author

I'm trying to devine your downlevel issue, without actually debugging, it. I wonder if the mouse wheel input is missing numBox, unfortunately I can't look at what this helper actually does.. maybe you could try to treewalk into a part and mouse wheel on that instead. =/

First of all thank you for your help! My guess would have been, that this test fails because like we noticed on other tests, there simply are differences on how VisualTree helper work and how we can get elements. So maybe this is an issue with that?

Though I have to admit, it's a bit unsettling that it just pops up now, now that we hide/show the header presenter :/

I will try to check if we could use a different UIA element to fire the event on. Hopefully that helps.

@marcelwgn
Copy link
Collaborator Author

So we can also send the events directly to the TextBox contained inside the NumberBox template. Maybe this will fix the test failures on some versions.

@kmahone
Copy link
Member

kmahone commented Apr 7, 2020

/azp run

@azure-pipelines
Copy link

Commenter does not have sufficient privileges for PR 2148 in repo microsoft/microsoft-ui-xaml

@kmahone
Copy link
Member

kmahone commented Apr 7, 2020

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@StephenLPeters
Copy link
Contributor

I think one of us just has to spend the time getting this failure under the debugger to see whats going on.

@ranjeshj
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@@ -316,14 +316,14 @@ public void ScrollTest()

FindTextBox(numBox).SetFocus();
Copy link
Contributor

Choose a reason for hiding this comment

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

Marcel, can you try adding a WaitForIdle here after setting focus ? From the test failure in downlevel, the verify with the value of 2 is failing with value of 0 which might be because the mouse wheel events are going before focus is set.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good idea, merged with master and added a wait after setting focus.

@ranjeshj
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@kmahone
Copy link
Member

kmahone commented Apr 24, 2020

Looks like NumberBoxTests.ScrollTest is failing on RS4 and below. I will take a look.

@kmahone
Copy link
Member

kmahone commented Apr 24, 2020

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@kmahone
Copy link
Member

kmahone commented Apr 24, 2020

The cause of the test failure was due to the fact that the test ui did not fully fit in the window. The test machines all run at 1024x768. For the NumberBox test page, the test UI was getting squeezed off the screen. On RS5 it just barely fit, but on RS4 it was fully off the screen.

I've fixed the issue by switching the Orientation of the TextBox.

@marcelwgn
Copy link
Collaborator Author

Oh I see. That's good to know. Thank you so much for fixing this!

@StephenLPeters StephenLPeters merged commit 41c7fa3 into microsoft:master Apr 28, 2020
@marcelwgn marcelwgn deleted the fix-multiple-header-issues branch May 15, 2020 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-NumberBox NumberBox Control team-Controls Issue for the Controls team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants