1. 08 Aug, 2019 2 commits
    • Tong Mu's avatar
      Fix mouse region crash when using closures (#37342) · 55fd5f15
      Tong Mu authored
      This PR fixes an issue where MouseRegion crashes when being passed with closures instead of methods.
      
      It changes how a RenderMouseRegion handles its MouseTrackingAnnotation.
      
      Instead of creating a new annotation every time it becomes active and destroys it when deactivated, it now creates an annotation during the constructor and holds onto it until the end of its lifecycle.
      Instead of directly passing the argument callbacks to the annotation, it proxies them using methods.
      55fd5f15
    • Tong Mu's avatar
      Fix mouse region double render (#37344) · e4a909fb
      Tong Mu authored
      Fix an issue where MouseRegion will render its children twice.
      e4a909fb
  2. 07 Aug, 2019 1 commit
  3. 01 Aug, 2019 1 commit
    • Tong Mu's avatar
      Split Mouse from Listener (#36217) · 5bb8d8fc
      Tong Mu authored
      - Splits on{Enter,Hover,Exit} from Listener to MouseRegion. Deprecated API is kept for compatibility.
      - Splits on{Enter,Hover,Exit} from RenderPointerListener to RenderMouseRegion.
      5bb8d8fc
  4. 31 May, 2019 1 commit
  5. 30 May, 2019 1 commit
    • Greg Spencer's avatar
      Fix onExit calling when the mouse is removed. (#33477) · 07aede4c
      Greg Spencer authored
      This PR solves two problems: currently, the onExit is called for a mouse pointer the moment the removal message is received, except that by the time it actually calls it, there is no _lastEvent for it in the mouse tracker (it's already been removed), resulting in an event being passed to the onExit that contains nulls for the position. Also, removePointer events don't actually get created with a position, although they easily could be, so that even the the _lastEvent in the mouse tracker were still populated, it would still give a null position and delta.
      
      This PR adds support for the position and delta in a PointerRemovedEvent, and populates them. In addition, when a remove event is received, it doesn't actually remove the pointer until the mouse position check that gets scheduled actually happens.
      07aede4c
  6. 15 May, 2019 1 commit
    • Greg Spencer's avatar
      Fix needsCompositing propagation from child widgets. (#32717) · ed90d055
      Greg Spencer authored
      This fixes propagation of needsCompositing from child widgets.
      
      When needsCompositing is turned on by a child widget, it necessarily sets the needsCompositing bit of its parent widget, but RenderPointerListener was ignoring that piece of information and only turning on compositing if it thought it needed it for itself.
      
      This corrects that, and adds a test for the condition, and updates a test that was affected by the change.
      
      Fixes #32525 (again)
      ed90d055
  7. 13 May, 2019 1 commit
    • Greg Spencer's avatar
      Fix transforms for things with RenderPointerListeners (#32535) · a5053bfb
      Greg Spencer authored
      This fixes #32525, because it now marks the compositing bits as needing to be recalculated if the mouse tracker changes its idea of whether or not a mouse is attached.
      
      This bug occurred because the test framework was leaking state from one test to the next (the state about whether a mouse pointer was active), and so even though there was a "passing" test when run in order with the other tests in the file, when the test was run individually (or first), it would have failed and caught the bug.
      
      This adds an assert to make sure that after each test there are no simulated mouse pointers connected, and now calls removePointer in all of the tests where this was a problem.
      a5053bfb
  8. 09 May, 2019 2 commits
    • Phil Quitslund's avatar
      More const conversions (#32408) · 3a6acb8c
      Phil Quitslund authored
      * update immutable to const
      
      * => const lists
      
      * revert making list const
      
      * make Centers const
      3a6acb8c
    • Greg Spencer's avatar
      Fix nested listeners so that ancestor listeners can also receive enter/exit/move events. (#32350) · aeccd6a8
      Greg Spencer authored
      This changes Listener to trigger enter/move/exit in all Listeners below the pointer, not just the leaf region (the first region hit). This is because we need to allow listeners to be nested so that, say, a widget that handles changing color on hover, but also is wrapped in a Tooltip (that handles hover) can trigger both actions, not just one.
      
      To that end, I added a findAll to Layer, similar to the existing find method that was previously used. It returns an iterator over annotated layers which match the given data type.
      
      Since the findAll is implemented as returning an Iterable (and is sync*), I re-implemented the find routines as just returning the first result from findAll, since that should be just as efficient, and would then prevent duplication in the implementation.
      aeccd6a8
  9. 08 May, 2019 1 commit
    • Greg Spencer's avatar
      Fix RenderPointerListener so that callbacks aren't called at the wrong time. (#32142) · 23baae0e
      Greg Spencer authored
      I recently added some code to keep hover events from being propagated when a mouse wasn't attached. While that works, there are times when it can fire callbacks during the building of other components, since they can now be called from detach/attach. This is not ideal, since it will assert then. This changes the code so that it won't update the annotations during attach/detach, but also won't push the annotation layer unless a mouse is connected, achieving the same result as before, but with better semantics.
      
      The basic problem is that in the detach for RenderPointerListener, it would detach the annotation, which could cause onExit to be called on the annotation, since the widget was disappearing under the mouse, and thus needs to receive an onExit, but that onExit might be (and probably will be) calling setState, which marks the owning widget as needing to be built, sometimes when it already has been.
      
      The fix creates a new _ListenerElement that overrides activate and deactivate in order to tell the render object ahead of the detach that it might be detached, and so the onExit gets called before the detach instead of during it.
      
      In addition, I now avoid scheduling more than one check for mouse positions per frame.
      23baae0e
  10. 06 May, 2019 1 commit
  11. 11 Apr, 2019 1 commit
  12. 11 Mar, 2019 1 commit
    • Dwayne Slater's avatar
      Fix MouseTracker annotation leak (#28990) · b19df00c
      Dwayne Slater authored
      * Fix MouseTracker annotation leak
      
      Map's remove method is typed `remove(Object key)`, which can cause bugs.
      
      Modified the existing test to check if the annotation has been removed
      from MouseTracker.
      b19df00c
  13. 01 Mar, 2019 1 commit
    • Alexandre Ardhuin's avatar
      Add missing trailing commas (#28673) · 387f8854
      Alexandre Ardhuin authored
      * add trailing commas on list/map/parameters
      
      * add trailing commas on Invocation with nb of arg>1
      
      * add commas for widget containing widgets
      
      * add trailing commas if instantiation contains trailing comma
      
      * revert bad change
      387f8854
  14. 29 Jan, 2019 1 commit
    • Greg Spencer's avatar
      Implement hover support for mouse pointers. (#24830) · 1811d574
      Greg Spencer authored
      This implements support for hovering mouse pointers, so that mice connected to Android devices, and ChromeOS devices running Android apps will work properly.
      
      It teaches flutter_test about hover events, which required changing how they are created and used.
      
      Also modifies AnnotatedRegion to allow a region that can be located someplace other than just the origin.
      
      Along with tests for all of the above.
      
      Fixes #5504
      1811d574
  15. 12 Sep, 2018 1 commit
  16. 07 Sep, 2017 1 commit
  17. 07 Apr, 2017 1 commit
  18. 08 Mar, 2017 1 commit
  19. 04 Mar, 2017 1 commit
  20. 07 Nov, 2016 1 commit
  21. 16 May, 2016 1 commit
    • Ian Hickson's avatar
      Make it possible to run tests live on a device (#3936) · 32527017
      Ian Hickson authored
      This makes it possible to substitute 'flutter run' for 'flutter test'
      and actually watch a test run on a device.
      
      For any test that depends on flutter_test:
      
      1. Remove any import of 'package:test/test.dart'.
      
      2. Replace `testWidgets('...', (WidgetTester tester) {`
            with `testWidgets('...', (WidgetTester tester) async {`
      
      3. Add an "await" in front of calls to any of the following:
          * tap()
          * tapAt()
          * fling()
          * flingFrom()
          * scroll()
          * scrollAt()
          * pump()
          * pumpWidget()
      
      4. Replace any calls to `tester.flushMicrotasks()` with calls to
         `await tester.idle()`.
      
      There's a guarding API that you can use, if you have particularly
      complicated tests, to get better error messages. Search for
      TestAsyncUtils.
      32527017
  22. 04 May, 2016 1 commit
  23. 29 Apr, 2016 1 commit
    • Ian Hickson's avatar
      Refactor the test framework (#3622) · 91dd9699
      Ian Hickson authored
      * Refactor widget test framework
      
      Instead of:
      
      ```dart
        test("Card Collection smoke test", () {
          testWidgets((WidgetTester tester) {
      ```
      
      ...you now say:
      
      ```dart
        testWidgets("Card Collection smoke test", (WidgetTester tester) {
      ```
      
      Instead of:
      
      ```dart
        expect(tester, hasWidget(find.text('hello')));
      ```
      
      ...you now say:
      
      ```dart
        expect(find.text('hello'), findsOneWidget);
      ```
      
      Instead of the previous API (exists, widgets, widget, stateOf,
      elementOf, etc), you now have the following comprehensive API. All these
      are functions that take a Finder, except the all* properties.
      
      * `any()` - true if anything matches, c.f. `Iterable.any`
      * `allWidgets` - all the widgets in the tree
      * `widget()` - the one and only widget that matches the finder
      * `firstWidget()` - the first widget that matches the finder
      * `allElements` - all the elements in the tree
      * `element()` - the one and only element that matches the finder
      * `firstElement()` - the first element that matches the finder
      * `allStates` - all the `State`s in the tree
      * `state()` - the one and only state that matches the finder
      * `firstState()` - the first state that matches the finder
      * `allRenderObjects` - all the render objects in the tree
      * `renderObject()` - the one and only render object that matches the finder
      * `firstRenderObject()` - the first render object that matches the finder
      
      There's also `layers' which returns the list of current layers.
      
      `tap`, `fling`, getCenter, getSize, etc, take Finders, like the APIs
      above, and expect there to only be one matching widget.
      
      The finders are:
      
       * `find.text(String text)`
       * `find.widgetWithText(Type widgetType, String text)`
       * `find.byKey(Key key)`
       * `find.byType(Type type)`
       * `find.byElementType(Type type)`
       * `find.byConfig(Widget config)`
       * `find.byWidgetPredicate(WidgetPredicate predicate)`
       * `find.byElementPredicate(ElementPredicate predicate)`
      
      The matchers (for `expect`) are:
      
       * `findsNothing`
       * `findsWidgets`
       * `findsOneWidget`
       * `findsNWidgets(n)`
       * `isOnStage`
       * `isOffStage`
       * `isInCard`
       * `isNotInCard`
      
      Benchmarks now use benchmarkWidgets instead of testWidgets.
      
      Also, for those of you using mockers, `serviceMocker` now automatically
      handles the binding initialization.
      
      This patch also:
      
      * changes how tests are run so that we can more easily swap the logic
        out for a "real" mode instead of FakeAsync.
      
      * introduces CachingIterable.
      
      * changes how flutter_driver interacts with the widget tree to use the
        aforementioned new API rather than ElementTreeTester, which is gone.
      
      * removes ElementTreeTester.
      
      * changes the semantics of a test for scrollables because we couldn't
        convince ourselves that the old semantics made sense; it only worked
        before because flushing the microtasks after every event was broken.
      
      * fixes the flushing of microtasks after every event.
      
      * Reindent the tests
      
      * Fix review comments
      91dd9699
  24. 14 Apr, 2016 1 commit
  25. 16 Dec, 2015 1 commit
  26. 23 Nov, 2015 1 commit
  27. 16 Nov, 2015 1 commit
    • Hixie's avatar
      More resilient Widget tests · d041f3ea
      Hixie authored
      - force the time dilation to 1.0 for the Widget tests, so that a local
        change doesn't break all the tests during development.
      - add missing license block to all the files.
      - set ui.window.onBeginFrame to null when you use WidgetTester, so that
        the engine doesn't trigger any confusing frames after our fake frames.
      d041f3ea
  28. 10 Oct, 2015 1 commit
  29. 01 Oct, 2015 3 commits
  30. 25 Sep, 2015 1 commit
  31. 04 Sep, 2015 1 commit