Skip to content
Snippets Groups Projects
Commit f93fd660 authored by Botond Ballo's avatar Botond Ballo
Browse files

Bug 1593381 - Port TestSnapping to use WR inputs. r=hiro

parent c3d41036
No related branches found
No related tags found
No related merge requests found
......@@ -17,11 +17,12 @@ class APZCSnappingTesterLayersOnly : public APZCTreeManagerTester {
};
TEST_F(APZCSnappingTesterLayersOnly, Bug1265510) {
const char* layerTreeSyntax = "c(t)";
const char* treeShape = "x(x)";
nsIntRegion layerVisibleRegion[] = {nsIntRegion(IntRect(0, 0, 100, 100)),
nsIntRegion(IntRect(0, 100, 100, 100))};
root =
CreateLayerTree(layerTreeSyntax, layerVisibleRegion, nullptr, lm, layers);
CreateScrollData(treeShape, layerVisibleRegion);
auto& layers = scrollData;
WebRenderLayerScrollData* root = layers[0];
SetScrollableFrameMetrics(root, ScrollableLayerGuid::START_SCROLL_ID,
CSSRect(0, 0, 100, 200));
SetScrollableFrameMetrics(layers[1], ScrollableLayerGuid::START_SCROLL_ID + 1,
......@@ -33,12 +34,12 @@ TEST_F(APZCSnappingTesterLayersOnly, Bug1265510) {
snap.mSnapPositionY.AppendElement(0 * AppUnitsPerCSSPixel());
snap.mSnapPositionY.AppendElement(100 * AppUnitsPerCSSPixel());
ScrollMetadata metadata = root->GetScrollMetadata(0);
metadata.SetSnapInfo(ScrollSnapInfo(snap));
root->SetScrollMetadata(metadata);
ModifyFrameMetrics(root, [&](ScrollMetadata& aSm, FrameMetrics&) {
aSm.SetSnapInfo(ScrollSnapInfo(snap));
});
UniquePtr<ScopedLayerTreeRegistration> registration =
MakeUnique<ScopedLayerTreeRegistration>(LayersId{0}, root, mcc);
MakeUnique<ScopedLayerTreeRegistration>(LayersId{0}, mcc);
UpdateHitTestingTree();
TestAsyncPanZoomController* outer = ApzcOf(layers[0]);
......@@ -87,12 +88,12 @@ TEST_F(APZCSnappingTesterLayersOnly, Bug1265510) {
}
TEST_F(APZCSnappingTesterLayersOnly, Snap_After_Pinch) {
const char* layerTreeSyntax = "c";
const char* treeShape = "x";
nsIntRegion layerVisibleRegion[] = {
nsIntRegion(IntRect(0, 0, 100, 100)),
};
root =
CreateLayerTree(layerTreeSyntax, layerVisibleRegion, nullptr, lm, layers);
CreateScrollData(treeShape, layerVisibleRegion);
WebRenderLayerScrollData* root = scrollData[0];
SetScrollableFrameMetrics(root, ScrollableLayerGuid::START_SCROLL_ID,
CSSRect(0, 0, 100, 200));
......@@ -106,13 +107,13 @@ TEST_F(APZCSnappingTesterLayersOnly, Snap_After_Pinch) {
// Save the scroll snap info on the root APZC.
// Also mark the root APZC as "root content", since APZC only allows
// zooming on the root content APZC.
ScrollMetadata metadata = root->GetScrollMetadata(0);
metadata.SetSnapInfo(ScrollSnapInfo(snap));
metadata.GetMetrics().SetIsRootContent(true);
root->SetScrollMetadata(metadata);
ModifyFrameMetrics(root, [&](ScrollMetadata& aSm, FrameMetrics& aMetrics) {
aSm.SetSnapInfo(ScrollSnapInfo(snap));
aMetrics.SetIsRootContent(true);
});
UniquePtr<ScopedLayerTreeRegistration> registration =
MakeUnique<ScopedLayerTreeRegistration>(LayersId{0}, root, mcc);
MakeUnique<ScopedLayerTreeRegistration>(LayersId{0}, mcc);
UpdateHitTestingTree();
RefPtr<TestAsyncPanZoomController> apzc = ApzcOf(root);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment