Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Obscure assert triggered in GestureArena with specific sequence of test gestures #3441

@mpcomplete

Description

@mpcomplete

Steps to Reproduce

While writing a test for selection handle dragging, I ran into an obscure assert in GestureArenas. Here is the offending code from input_test.dart (the drag+drop part). Unfortunately, it only happened under very specific circumstances.

  Point ePos = textOffsetToPosition(tester, testValue.indexOf('e'));
  TestGesture gesture = tester.startGesture(ePos, pointer: 7);
  tester.pump(const Duration(seconds: 2));
  gesture.up();
  tester.pump();

  gesture = tester.startGesture(ePos, pointer: 7);
  tester.pump();
  gesture.moveBy(new Offset(15.0, 0.0));

The following small changes prevented the assert from tripping:

  • change one of the pointers to a different value.
  • change the moveBy amount to, say, (5.0, 0.0) or (20.0, 0.0). Some values work, others don't.
  • change the position of the second gesture to something else. Again, some values work, others don't.

I'm not sure why this particular combination of values broke things.

Flutter Doctor

[✓] Flutter (on Linux, channel master)
    • Flutter at /usr/local/google/home/mpcomplete/src/flutter
    • Framework revision 9beee3f (10 minutes ago), engine revision 284929b

[✓] Android toolchain - develop for Android devices (Android SDK 22.0.1)
    • Android SDK at /usr/local/google/home/mpcomplete/src/engine/src/third_party/android_tools/sdk
    • Platform android-22, build-tools 22.0.1
    • OpenJDK Runtime Environment (build 1.8.0-google-v7-117372415-117822431)

[✓] Atom - a lightweight development environment for Flutter
    • Atom installed; Flutter plugin version 0.2.1

Logs and Crash Reports

══╡ EXCEPTION CAUGHT BY GESTURE LIBRARY ╞═══════════════════════════════════════════════════════════
The following assertion was thrown while routing a pointer event:
'package:flutter/src/gestures/arena.dart': Failed assertion: line 150 pos 12:
'state.members.contains(member)' is not true.
Either the assertion indicates an error in the framework itself, or we should provide substantially
more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
  https://github.com/flutter/flutter/issues/new
Event:
  PointerMoveEvent(Point(36.0, 306.5))
Stack trace:
#0      _AssertionError._throwNew (dart:core-patch/errors_patch.dart:27)
#1      GestureArenaManager._resolve (package:flutter/src/gestures/arena.dart:150:12)
#2      GestureArenaEntry.resolve (package:flutter/src/gestures/arena.dart:45:12)
#3      OneSequenceGestureRecognizer.resolve (package:flutter/src/gestures/recognizer.dart:77:13)
#4      TapGestureRecognizer.resolve (package:flutter/src/gestures/tap.dart:45:18)
#5      PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:148:9)
#6      PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:53:14)
#7      BindingBase&Scheduler&Gesturer.handleEvent (package:flutter/src/gestures/binding.dart:110:19)
#8      BindingBase&Scheduler&Gesturer.dispatchEvent (package:flutter/src/gestures/binding.dart:88:22)
#9      Instrumentation.dispatchEvent (package:flutter_test/src/instrumentation.dart:261:13)
#10     ElementTreeTester.dispatchEvent (package:flutter_test/src/element_tree_tester.dart:143:24)
#11     TestGesture.moveTo (package:flutter_test/src/instrumentation.dart:278:13)
#12     main.<anonymous closure>.<anonymous closure> (///usr/local/google/home/mpcomplete/src/flutter/packages/flutter/test/widget/input_test.dart:317:15)
#13     testWidgets.<anonymous closure> (package:flutter_test/src/widget_tester.dart:29:13)
#14     testElementTree.<anonymous closure> (package:flutter_test/src/element_tree_tester.dart:184:15)
#15     _FakeAsync.run.<anonymous closure> (package:quiver/testing/src/async/fake_async.dart:187:43)
#16     _rootRun (dart:async/zone.dart:895)
#17     _CustomZone.run (dart:async/zone.dart:790)
#18     _CustomZone.runGuarded (dart:async/zone.dart:696)
#19     _FakeAsync.run (package:quiver/testing/src/async/fake_async.dart:187:18)
#20     testElementTree (package:flutter_test/src/element_tree_tester.dart:170:19)
#21     testWidgets (package:flutter_test/src/widget_tester.dart:28:3)
#22     main.<anonymous closure> (///usr/local/google/home/mpcomplete/src/flutter/packages/flutter/test/widget/input_test.dart:235:5)
#23     Declarer.test.<anonymous closure>.<<anonymous closure>_async_body>.<anonymous closure>.<<anonymous closure>_async_body> (package:test/src/backend/declarer.dart:88:19)
#24     _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:27)
#25     StackZoneSpecification.registerUnaryCallback.<anonymous closure>.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:135:26)
#26     StackZoneSpecification._run (package:stack_trace/src/stack_zone_specification.dart:206:15)
#27     StackZoneSpecification.registerUnaryCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:135:14)
#28     _rootRunUnary (dart:async/zone.dart:902)
#29     _CustomZone.runUnary (dart:async/zone.dart:798)
#30     _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:553)
#31     _Future._propagateToListeners (dart:async/future_impl.dart:639)
#32     _Future._complete (dart:async/future_impl.dart:416)
#33     _SyncCompleter.complete (dart:async/future_impl.dart:52)
#34     Declarer._runSetUps.<_runSetUps_async_body> (package:test/src/backend/declarer.dart:167:3)
#35     _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:27)
#36     StackZoneSpecification.registerUnaryCallback.<anonymous closure>.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:135:26)
#37     StackZoneSpecification._run (package:stack_trace/src/stack_zone_specification.dart:206:15)
#38     StackZoneSpecification.registerUnaryCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:135:14)
#39     _rootRunUnary (dart:async/zone.dart:902)
#40     _CustomZone.runUnary (dart:async/zone.dart:798)
#41     _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:553)
#42     _Future._propagateToListeners (dart:async/future_impl.dart:639)
#43     _Future._complete (dart:async/future_impl.dart:416)
#44     Future.doWhile.<anonymous closure> (dart:async/future.dart:389)
#45     StackZoneSpecification.registerUnaryCallback.<anonymous closure>.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:135:26)
#46     StackZoneSpecification._run (package:stack_trace/src/stack_zone_specification.dart:206:15)
#47     StackZoneSpecification.registerUnaryCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:135:14)
#48     _rootRunUnary (dart:async/zone.dart:902)
#49     _CustomZone.runUnary (dart:async/zone.dart:798)
#50     _CustomZone.runUnaryGuarded (dart:async/zone.dart:704)
#51     _CustomZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:730)
#52     StackZoneSpecification.registerUnaryCallback.<anonymous closure>.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:135:26)
#53     StackZoneSpecification._run (package:stack_trace/src/stack_zone_specification.dart:206:15)
#54     StackZoneSpecification.registerUnaryCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:135:14)
#55     _rootRunUnary (dart:async/zone.dart:902)
#56     _CustomZone.runUnary (dart:async/zone.dart:798)
#57     _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:553)
#58     _Future._propagateToListeners (dart:async/future_impl.dart:639)
#59     _Future._completeWithValue (dart:async/future_impl.dart:426)
#60     _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:481)
#61     StackZoneSpecification._run (package:stack_trace/src/stack_zone_specification.dart:206:15)
#62     StackZoneSpecification.registerCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:125:48)
#63     _rootRun (dart:async/zone.dart:895)
#64     _CustomZone.run (dart:async/zone.dart:790)
#65     _CustomZone.runGuarded (dart:async/zone.dart:696)
#66     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:721)
#67     _microtaskLoop (dart:async/schedule_microtask.dart:41)
#68     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: tests"flutter test", flutter_test, or one of our testsc: crashStack traces logged to the consoleframeworkflutter/packages/flutter repository. See also f: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions