mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 19:17:10 +00:00
test(runner): assert double-tap delegates to driver DoubleTap
This commit is contained in:
1 parent
3eb08c10b4
commit
d154b61d3f
1 file changed
+8
-13
@@ -430,30 +430,25 @@ func TestApplyAction_V8InputTextAtOriginStillTaps(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestApplyAction_DoubleTapDispatchesTwoTapsAtCoordinates(t *testing.T) {
|
||||
func TestApplyAction_DoubleTapDispatchesDoubleTapAtCoordinates(t *testing.T) {
|
||||
driverMock := mockdriver.New()
|
||||
action := verifier.Action{Kind: verifier.ActionKindDoubleTap, X: 100, Y: 200}
|
||||
|
||||
start := time.Now()
|
||||
if err := applyAction(context.Background(), driverMock, action, nil); err != nil {
|
||||
t.Fatalf("apply action: %v", err)
|
||||
}
|
||||
elapsed := time.Since(start)
|
||||
if elapsed < 40*time.Millisecond {
|
||||
t.Errorf("expected >= 40ms gap between taps, elapsed %v", elapsed)
|
||||
}
|
||||
taps := 0
|
||||
for _, a := range driverMock.Actions() {
|
||||
if a.Kind == mockdriver.ActionTap && a.X == 100 && a.Y == 200 {
|
||||
if a.Kind == mockdriver.ActionDoubleTap && a.X == 100 && a.Y == 200 {
|
||||
taps++
|
||||
}
|
||||
}
|
||||
if taps != 2 {
|
||||
t.Errorf("expected 2 Tap calls at (100,200), got %d in %v", taps, driverMock.Actions())
|
||||
if taps != 1 {
|
||||
t.Errorf("expected 1 DoubleTap call at (100,200), got %d in %v", taps, driverMock.Actions())
|
||||
}
|
||||
}
|
||||
|
||||
func TestApplyAction_DoubleTapDispatchesTwoSelectorTaps(t *testing.T) {
|
||||
func TestApplyAction_DoubleTapDispatchesDoubleTapSelector(t *testing.T) {
|
||||
driverMock := mockdriver.New()
|
||||
action := verifier.Action{Kind: verifier.ActionKindDoubleTap, On: "id:save"}
|
||||
|
||||
@@ -462,12 +457,12 @@ func TestApplyAction_DoubleTapDispatchesTwoSelectorTaps(t *testing.T) {
|
||||
}
|
||||
taps := 0
|
||||
for _, a := range driverMock.Actions() {
|
||||
if a.Kind == mockdriver.ActionTapSelector && a.Selector == "id:save" {
|
||||
if a.Kind == mockdriver.ActionDoubleTapSelector && a.Selector == "id:save" {
|
||||
taps++
|
||||
}
|
||||
}
|
||||
if taps != 2 {
|
||||
t.Errorf("expected 2 TapSelector calls with id:save, got %d in %v", taps, driverMock.Actions())
|
||||
if taps != 1 {
|
||||
t.Errorf("expected 1 DoubleTapSelector call with id:save, got %d in %v", taps, driverMock.Actions())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user