1. 09 Jan, 2018 1 commit
  2. 08 Dec, 2017 1 commit
    • Ian Hickson's avatar
      Fix tapping on a test in flutter run (#13397) · d25e0eb0
      Ian Hickson authored
      Also:
      
      * Remove find.byIcon since it's identical to find.icon. (I sent mail to flutter-dev about this.)
      
      * Fix IconData's operator== and hashCode, which had not been updated when we added fields.
      
      * Add the byTooltip finder to the list of suggested finders.
      
      * Make the suggested Key finder prettier.
      Unverified
      d25e0eb0
  3. 17 Nov, 2017 1 commit
  4. 31 Oct, 2017 1 commit
  5. 29 Sep, 2017 1 commit
  6. 21 Sep, 2017 1 commit
  7. 05 May, 2017 1 commit
  8. 02 May, 2017 1 commit
    • Ian Hickson's avatar
      Flush microtasks after transient callbacks are run. (#9702) · e8c46927
      Ian Hickson authored
      This splits the frame pipeline into two, beginFrame and drawFrame.
      
      As part of making this change I added some debugging hooks that helped
      debug the issues that came up:
      
       * I added debugPrintScheduleFrameStacks which prints a stack whenever
         a frame is actually scheduled, so you can see why frames are being
         scheduled.
      
       * I added some toString output to EditableText and RawKeyboardListener.
      
       * I added a scheduler_tester.dart library for scheduler library tests.
      
       * I changed the test framework to flush microtasks before pumping.
      
       * Some asserts that had the old string literal form were replaced by
         asserts with messages.
      
      I also fixed a few subtle bugs that this uncovered:
      
       * setState() now calls `ensureVisualUpdate`, rather than
         `scheduleFrame`. This means that calling it from an
         AnimationController callback does not actually schedule an extra
         redundant frame as it used to.
      
       * I corrected some documentation.
      e8c46927
  9. 14 Apr, 2017 1 commit
  10. 12 Apr, 2017 2 commits
    • Ian Hickson's avatar
      Move Point to Offset (#9277) · bf017b79
      Ian Hickson authored
      * Manually fix every use of Point.x and Point.y
      
      Some of these were moved to dx/dy, but not all.
      
      * Manually convert uses of the old gradient API
      
      * Remove old reference to Point.
      
      * Mechanical changes
      
      I applied the following at the root of the Flutter repository:
      
      git ls-files -z | xargs -0 sed -i 's/\bPoint[.]origin\b/Offset.zero/g'
      git ls-files -z | xargs -0 sed -i 's/\bPoint[.]lerp\b/Offset.lerp/g'
      git ls-files -z | xargs -0 sed -i 's/\bnew Point\b/new Offset/g'
      git ls-files -z | xargs -0 sed -i 's/\bconst Point\b/const Offset/g'
      git ls-files -z | xargs -0 sed -i 's/\bstatic Point /static Offset /g'
      git ls-files -z | xargs -0 sed -i 's/\bfinal Point /final Offset /g'
      git ls-files -z | xargs -0 sed -i 's/^\( *\)Point /\1Offset /g'
      git ls-files -z | xargs -0 sed -i 's/ui[.]Point\b/ui.Offset/g'
      git ls-files -z | xargs -0 sed -i 's/(Point\b/(Offset/g'
      git ls-files -z | xargs -0 sed -i 's/\([[{,]\) Point\b/\1 Offset/g'
      git ls-files -z | xargs -0 sed -i 's/@required Point\b/@required Offset/g'
      git ls-files -z | xargs -0 sed -i 's/<Point>/<Offset>/g'
      git ls-files -z | xargs -0 sed -i 's/[.]toOffset()//g'
      git ls-files -z | xargs -0 sed -i 's/[.]toPoint()//g'
      git ls-files -z | xargs -0 sed -i 's/\bshow Point, /show /g'
      git ls-files -z | xargs -0 sed -i 's/\bshow Point;/show Offset;/g'
      
      * Mechanical changes - dartdocs
      
      I applied the following at the root of the Flutter repository:
      
      git ls-files -z | xargs -0 sed -i 's/\ba \[Point\]/an [Offset]/g'
      git ls-files -z | xargs -0 sed -i 's/\[Point\]/[Offset]/g'
      
      * Further improvements and a test
      
      * Fix minor errors from rebasing...
      
      * Roll engine
      bf017b79
    • Ian Hickson's avatar
      Fix tests to use Ahem, and helpful changes around that (#9332) · 2a545243
      Ian Hickson authored
      * Fix tests to use Ahem, and helpful changes around that
      
      - Fix fonts that had metric-specific behaviours.
      
      - LiveTestWidgetsFlutterBinding.allowAllFrames has been renamed
        to LiveTestWidgetsFlutterBinding.framePolicy.
      
      - LiveTestWidgetsFlutterBinding now defaults to using a frame policy
        that pumps slightly more frames, to animate the pointer crosshairs.
      
      - Added "flutter run --use-test-fonts" to enable Ahem on devices.
      
      - Changed how idle() works to be more effective in live mode.
      
      - Display the test name in live mode (unless ahem fonts are enabled).
      
      - Added a toString to TextSelectionPoint.
      
      - Style nit fixes.
      
      * Roll engine to get Ahem changes.
      
      * Update tests for dartdoc changes.
      
      * Fix flutter_tools tests
      2a545243
  11. 05 Apr, 2017 1 commit
  12. 02 Apr, 2017 1 commit
  13. 20 Mar, 2017 1 commit
  14. 13 Mar, 2017 1 commit
  15. 04 Mar, 2017 1 commit
  16. 23 Feb, 2017 1 commit
    • Phil Quitslund's avatar
      Bump to test `0.12.20`. (#8349) · a002e720
      Phil Quitslund authored
      * Bump to test `0.12.20`.
      
      Some test `0.12.20` highlights:
        * introduces `expectLater()`  that returns a `Future` that completes when the matcher has finished running
        * deprecates the `verbose` parameter to `expect()` and the `formatFailure()` (to be removed in `0.13.0`)
      
      Otherwise:
        * to keep up w/ the deprecation of `verbose`, removes `widget_tester` API to pass `verbose` flag (alternatively we could suppress the warning for now)
      
      * Update stack manipulation.
      
      * Fix framecount.
      a002e720
  17. 18 Feb, 2017 1 commit
  18. 08 Feb, 2017 1 commit
  19. 07 Feb, 2017 1 commit
  20. 22 Jan, 2017 1 commit
  21. 12 Jan, 2017 1 commit
  22. 08 Nov, 2016 1 commit
  23. 26 Sep, 2016 1 commit
    • Ian Hickson's avatar
      Turn off AnimationControllers when not in use (#5902) · 9e673853
      Ian Hickson authored
      This requires all AnimationController objects to be given a
      TickerProvider, a class that can create the Ticker.
      
      It also provides some nice mixins for people who want to have their
      State provide a TickerProvider. And a schedulerTickerProvider for those
      cases where you just want to see your battery burn.
      
      Also, we now enforce destruction order for elements.
      9e673853
  24. 08 Sep, 2016 1 commit
    • Ian Hickson's avatar
      Make tests more realistic (#5762) · 5bc8888e
      Ian Hickson authored
      Previously, pumpWidget() would do a partial pump (it didn't trigger
      Ticker callbacks or post-frame callbacks), and pump() would do a full
      pump. This patch brings them closer together. It also makes runApp run a
      full actual frame, rather than skipping the transient callback part of
      the frame logic. Having "half-frames" in the system was confusing and
      could lead to bugs where code expecting to run before the next layout
      pass didn't because a "half-frame" ran first.
      
      Also, make Tickers start ticking in the frame that they were started in,
      if they were started during a frame. This means we no longer spin a
      frame for t=0, we jump straight to the first actual frame.
      
      Other changes in this patch:
      
      * rename WidgetsBinding._runApp to WidgetsBinding.attachRootWidget, so
        that tests can use it to more accurately mock out runApp.
      
      * allow loadStructuredData to return synchronously.
      
      * make handleBeginFrame handle not being given a time stamp.
      
      * make DataPipeImageProvider.loadAsync protected (rather than private),
        and document it. There wasn't really a reason for it to be private.
      
      * fix ImageConfiguration.toString.
      
      * introduce debugPrintBuildScope and debugPrintScheduleBuildForStacks,
        which can help debug problems with widgets getting marked as dirty but
        not cleaned.
      
      * make debugPrintRebuildDirtyWidgets say "Building" the first time and
        "Rebuilding" the second, to make it clearer when a widget is first
        created. This makes debugging widget lifecycle issues much easier.
      
      * make debugDumpApp more resilient.
      
      * debugPrintStack now takes a label that is printed before the stack.
      
      * improve the banner shown for debugPrintBeginFrameBanner.
      
      * various and sundry documentation fixes
      5bc8888e
  25. 01 Sep, 2016 1 commit
  26. 29 Aug, 2016 1 commit
  27. 11 Aug, 2016 1 commit
    • Ian Hickson's avatar
      Improve our scroll physics on iOS (#5340) · 17cdc889
      Ian Hickson authored
      Changes in this patch:
      - iOS now uses a different scrollDrag constant than Android.
         - ScrollConfigurationDelegate now knows about target platforms.
         - ScrollBehaviors now know about target platforms.
         - RawInputLine now has to be told what platform it's targetting.
         - PageableList now has a concept of target platform.
      - make debugPrintStack filter its stack.
         - move debugPrintStack to `assertions.dart`.
      - add support for limiting the number of frames to debugPrintStack.
      - make defaultTargetPlatform default to android in test environments.
      - remove OverscrollStyle and MaterialApp's overscrollStyle argument. You
        can now control the overscroll style using Theme.platform.
      - the default scroll configuration is now private to avoid people
        relying on the defaultTargetPlatform getter in their subclasses (since
        they really should use Theme.of(context).platform).
      - fix some typos I noticed in some tests.
      - added a test for flinging scrollables, that checks that the behavior
        differs on the two target platforms.
      - made flingFrom and fling in the test API pump the frames.
      - added more docs to the test API.
      - made the TestAsyncUtils.guard() method report uncaught errors to help
        debug errors when using that API.
      17cdc889
  28. 23 May, 2016 2 commits
  29. 20 May, 2016 1 commit
  30. 18 May, 2016 1 commit
    • Ian Hickson's avatar
      Some cleanup of the test framework (#4001) · d2c8c82f
      Ian Hickson authored
      * Add a "build" phase to EnginePhase for completeness.
      * Ignore events from the device during test execution.
      * More dartdocs
      * Slightly more helpful messages about Timers in verifyInvariants.
      * Add widgetList, elementList, stateList, renderObjectList.
      * Send test events asynchronously for consistency with other APIs.
      * Fix a test that was depending on test events being synchronous (or
        rather, scheduled in a microtask that came before the microtask for
        the completer of the future that the tap() function returned).
      d2c8c82f
  31. 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
  32. 04 May, 2016 1 commit
    • Adam Barth's avatar
      Skip the gallery smoke test (#3736) · 8da98105
      Adam Barth authored
      This test hangs occationally on the bots and the bots aren't smart enough to
      recover, which means the whole project gets blocked.
      
      Filed #3735 about the hang.
      8da98105
  33. 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
  34. 28 Apr, 2016 1 commit
  35. 26 Apr, 2016 1 commit
    • Adam Barth's avatar
      Delay win-by-default in gesture arena (#3552) · 51b1550d
      Adam Barth authored
      Wait until the end of the microtask to tell gesture recognizers that
      they've won in the gesture arena. This lets recognizers dispose reject
      themselves at arbitrary times without triggering gestures in awkward
      call stacks.
      
      Fixes #3183
      51b1550d
  36. 25 Apr, 2016 1 commit
  37. 22 Apr, 2016 1 commit
  38. 21 Apr, 2016 1 commit
    • Ian Hickson's avatar
      Minor widget_tester refactoring and docs (#3472) · c167efca
      Ian Hickson authored
      This reorders some classes so that this file makes more sense, and adds
      a bunch of docs. It also makes the following changes:
      
      * Move allElements from Instrumentation to TestWidgets. (Instrumentation
        is going away.)
      
      * Remove findElements.
      
      * Rename byElement to byElementPredicate
      
      * Rename byPredicate to byWidgetPredicate
      
      * Implement _WidgetPredicateFinder so that byWidgetPredicate has good
        messages
      
      * Fix one use of byElementPredicate to use byWidgetPredicate.
      c167efca