<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../utils.js"></script>
<script>

'use strict';

target_test((target, test) => {
    target.style.touchAction = "none";
    const eventTracker = new EventTracker(target, ["pointerdown", "gotpointercapture", "pointermove", "pointerup", "lostpointercapture"]);

    const one = ui.finger();
    const two = ui.finger();
    ui.sequence([
        one.begin({ x: 10, y: 10 }),
        two.begin({ x: 50, y: 50 }),
        one.move({ x: 30, y: 30 }),
        two.move({ x: 70, y: 70 }),
        one.end(),
        two.end()
    ]).then(() => {
        eventTracker.assertMatchesEvents([
            { id: 1, type: "pointerdown" },
            { id: 2, type: "pointerdown" },
            { id: 1, type: "gotpointercapture", isPrimary: true },
            { id: 1, type: "pointermove" },
            { id: 2, type: "gotpointercapture", isPrimary: false },
            { id: 2, type: "pointermove" },
            { id: 1, type: "pointerup" },
            { id: 1, type: "lostpointercapture", isPrimary: true },
            { id: 2, type: "pointerup" },
            { id: 2, type: "lostpointercapture", isPrimary: false }
        ]);
        test.done();
    });
}, "Pointer events for a direct manipulation device trigger 'gotpointercapture' and 'lostpointercapture' events due to implicit capture.");

</script>
</body>
</html>