Skip to content

Commit

Permalink
chore: refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
vatsashah45 committed Oct 10, 2024
1 parent 7194825 commit d1ddfee
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 46 deletions.
11 changes: 7 additions & 4 deletions src/Uno.Toolkit.RuntimeTests/Tests/ZoomContentControlTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ public async Task When_ContentBounds_ShouldHideScrollBars()
SUT.IsVerticalScrollBarVisible.Should().BeTrue();
}

// FindFirstDescendent is not available in UWP
#if !IS_UWP
[TestMethod]
public async Task When_Pan_ShouldUpdateOffsets()
{
Expand All @@ -151,20 +153,21 @@ public async Task When_Pan_ShouldUpdateOffsets()
HorizontalOffset = 0,
VerticalOffset = 0,
};

await UnitTestUIContentHelperEx.SetContentAndWait(SUT);

var presenter = SUT.FindFirstDescendant<ContentPresenter>("PART_Presenter");
var translation = (presenter?.RenderTransform as TransformGroup)?.Children[1] as TranslateTransform
?? throw new Exception("Failed to find PART_Presenter's TranslateTransform");

// Simulate panning
SUT.HorizontalOffset = 50;
SUT.VerticalOffset = 50;

// Verify that the content's translate transform has been updated to reflect the new offsets
translation.X.Should().Be(50);
translation.Y.Should().Be(50);
}
#endif
}
}
Loading

0 comments on commit d1ddfee

Please sign in to comment.