|
30 | 30 | using ScrollingBringingIntoViewEventArgs = Microsoft.UI.Xaml.Controls.ScrollingBringingIntoViewEventArgs;
|
31 | 31 | using ScrollPresenterTestHooks = Microsoft.UI.Private.Controls.ScrollPresenterTestHooks;
|
32 | 32 | using ScrollPresenterViewChangeResult = Microsoft.UI.Private.Controls.ScrollPresenterViewChangeResult;
|
| 33 | +using Windows.UI.Xaml.Shapes; |
33 | 34 |
|
34 | 35 | namespace Windows.UI.Xaml.Tests.MUXControls.ApiTests
|
35 | 36 | {
|
@@ -743,6 +744,43 @@ public void BringNestedElementIntoVerticalScrollViewerViewWithOffset()
|
743 | 744 | options);
|
744 | 745 | }
|
745 | 746 |
|
| 747 | + [TestMethod] |
| 748 | + [TestProperty("Description", "ScrollPresenter should handle BringIntoView for its direct content.")] |
| 749 | + public void BringContentWithMarginIntoView() |
| 750 | + { |
| 751 | + ScrollPresenter scrollPresenter = null; |
| 752 | + Rectangle rectangleScrollPresenterContent = null; |
| 753 | + AutoResetEvent scrollPresenterViewChangedEvent = new AutoResetEvent(false); |
| 754 | + AutoResetEvent scrollPresenterLoadedEvent = new AutoResetEvent(false); |
| 755 | + |
| 756 | + RunOnUIThread.Execute(() => |
| 757 | + { |
| 758 | + rectangleScrollPresenterContent = new Rectangle() { Margin = new Thickness(0, 500, 0, 0) }; |
| 759 | + scrollPresenter = new ScrollPresenter(); |
| 760 | + |
| 761 | + SetupDefaultUI(scrollPresenter, rectangleScrollPresenterContent, scrollPresenterLoadedEvent); |
| 762 | + }); |
| 763 | + |
| 764 | + WaitForEvent("Waiting for Loaded event", scrollPresenterLoadedEvent); |
| 765 | + |
| 766 | + RunOnUIThread.Execute(() => |
| 767 | + { |
| 768 | + scrollPresenter.ViewChanged += (s, e) => |
| 769 | + { |
| 770 | + scrollPresenterViewChangedEvent.Set(); |
| 771 | + }; |
| 772 | + |
| 773 | + rectangleScrollPresenterContent.StartBringIntoView(new BringIntoViewOptions() { AnimationDesired = false }); |
| 774 | + }); |
| 775 | + |
| 776 | + WaitForEvent("Waiting for ViewChanged event", scrollPresenterViewChangedEvent); |
| 777 | + |
| 778 | + RunOnUIThread.Execute(() => |
| 779 | + { |
| 780 | + Verify.AreEqual(500.0, scrollPresenter.VerticalOffset); |
| 781 | + }); |
| 782 | + } |
| 783 | + |
746 | 784 | private void BringElementIntoViewWithAlignment(
|
747 | 785 | Orientation orientation,
|
748 | 786 | double alignmentRatio,
|
|
0 commit comments