1. 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
  2. 07 Sep, 2016 1 commit
  3. 29 Aug, 2016 1 commit
    • Ian Hickson's avatar
      Fix some hero observer bugs (#5633) · dd2251ec
      Ian Hickson authored
      1: If a route is already dismissed when it's popped, there's no point
      trying to animate heroes, because it's going to be gone before the
      heroes code can look at it.
      
      2: If a hero animation finishes just as a new one is starting, we
      previously blew away the state for the starting one. Now we correctly
      segregate the "starting up quest" variables from the "actively ongoing
      quest" variables.
      dd2251ec
  4. 03 Aug, 2016 1 commit
  5. 29 Jul, 2016 1 commit
  6. 28 Jul, 2016 1 commit
    • Ian Hickson's avatar
      Some cleanup for hot reload (#5108) · 2b343a93
      Ian Hickson authored
      - show the next error fully after a hot reload
      - hide _AssertionError in stacks
      - immediately rebuild after a reassemble, so that hit tests work
      - catch errors when notifying global key listeners
      2b343a93
  7. 27 Jul, 2016 1 commit
  8. 15 Jul, 2016 1 commit
  9. 23 Jun, 2016 2 commits
  10. 02 Jun, 2016 1 commit
  11. 25 May, 2016 1 commit
  12. 18 May, 2016 1 commit
  13. 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
  14. 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
  15. 27 Apr, 2016 1 commit
  16. 22 Apr, 2016 4 commits
    • Adam Barth's avatar
      A blinking cursor should push only one frame (#3445) (#3506) · a5e794ca
      Adam Barth authored
      Prior to this patch, we were pushing two frames each time the cursor blinked.
      In turning the cursor on or off, the markNeedsPaint call was triggering another
      frame to be scheduled because we cleared a bit in the scheduler at the
      beginning of the frame instead of at the end of the frame.
      
      To implement scheduling correctly, we actually need two bits: one for
      ensureVisualUpdate, which just promises to get to the end of the pipeline soon,
      and scheduleFrame, which promises to get to the beginning of the pipeline soon.
      
      (Reland)
      a5e794ca
    • Ian Hickson's avatar
      Clean up our timeline events. (#3504) · b5a827bf
      Ian Hickson authored
      This adds in particular the ability to track the time at which the
      framework boots up, and the time at which we are confident we have
      completed the first useful frame.
      b5a827bf
    • Adam Barth's avatar
      Revert "A blinking cursor should push only one frame (#3445)" · c486fc4a
      Adam Barth authored
      This reverts commit 161f945e.
      
      This patch caused a number of regressions.
      
      Fixes #3497
      c486fc4a
    • Ian Hickson's avatar
      Rename binding abstract classes (#3482) · e968d91c
      Ian Hickson authored
      The old names were getting silly and started stepping on valuable namespace.
      
      The new names are consistent and clear.
      e968d91c
  17. 21 Apr, 2016 1 commit
    • Adam Barth's avatar
      A blinking cursor should push only one frame (#3445) · 161f945e
      Adam Barth authored
      Prior to this patch, we were pushing two frames each time the cursor blinked.
      In turning the cursor on or off, the markNeedsPaint call was triggering another
      frame to be scheduled because we cleared a bit in the scheduler at the
      beginning of the frame instead of at the end of the frame.
      
      To implement scheduling correctly, we actually need two bits: one for
      ensureVisualUpdate, which just promises to get to the end of the pipeline soon,
      and scheduleFrame, which promises to get to the beginning of the pipeline soon.
      161f945e
  18. 19 Apr, 2016 2 commits
    • Ian Hickson's avatar
      Refactor service extensions (#3397) · 261923e5
      Ian Hickson authored
      Bindings now have a debugRegisterServiceExtensions() method that is
      invoked in debug mode (only). (Once we have a profile mode, there'll be
      a registerProfileServiceExtensions() method that gets called in that
      mode only to register extensions that apply then.)
      
      The BindingBase class provides convenience methods for registering
      service extensions that do the equivalent of:
      
      ```dart
      void extension() { ... }
      bool extension([bool enabled]) { ... }
      double extension([double extension])  { ... }
      Map<String, String> extension([Map<String, String> parameters]) { ... }
      ```
      
      The BindingBase class also itself registers ext.flutter.reassemble,
      which it has call a function on the binding called
      reassembleApplication().
      
      The Scheduler binding now exposes the preexisting
      ext.flutter.timeDilation.
      
      The Renderer binding now exposes the preexisting ext.flutter.debugPaint.
      
      The Renderer binding hooks reassembleApplication to trigger the
      rendering tree to be reprocessed (in particular, to fix up the
      optimisation closures).
      
      All the logic from rendering/debug.dart about service extensions is
      replaced by the above.
      
      I moved basic_types to foundation.
      
      The FlutterWidgets binding hooks reassembleApplication to trigger the
      widget tree to be entirely rebuilt.
      
      Flutter Driver now uses ext.flutter.driver instead of
      ext.flutter_driver, and is hooked using the same binding mechanism.
      Eventually we'll probably move the logic into the Flutter library so
      that you just get it without having to invoke a special method first.
      261923e5
    • Ian Hickson's avatar
      Rearrange scheduling library (#3388) · 61605a9d
      Ian Hickson authored
      To be more consistent with other parts of the platform:
      
      * put the binding in a binding.dart file.
      
      * rearrange some members of the Scheduler class to be more close to
        execution order.
      
      * factor out Priority class into its own file.
      
      * add more dart docs.
      61605a9d
  19. 15 Apr, 2016 2 commits
  20. 13 Apr, 2016 1 commit
    • Ian Hickson's avatar
      Fix dependency skew. (#3306) · 7861d029
      Ian Hickson authored
      ...by adding tests to our examples that don't import flutter_test, which
      pins the relevant dependencies.
      
      Also, provide more information when complaining about leaked transient
      callbacks in tests.
      
      Also, make tests display full information when they have an exception,
      by bypassing the throttling we have for Android logging in tests.
      
      Also, make the word wrapping not wrap stack traces if they happen to
      be included in exception output.
      
      Also, fix a leaked transient callback in the checkbox code.
      7861d029
  21. 02 Apr, 2016 1 commit
    • Ian Hickson's avatar
      Rationalise all our exception handling. · ee703da9
      Ian Hickson authored
      - Create a FlutterErrorDetails struct-like class that describes an
      
        exception along with more details that aren't in the exception, like
      
        where it was caught and what was going on when it was caught.
      
      
      
      - Provide a FlutterError static API for handling these objects:
      
      
      
        - FlutterError.onError which is called whenever Flutter catches an
      
          error.
      
      
      
        - FlutterError.reportError() which handles an error.
      
      
      
        - FlutterError.dumpErrorToConsole() which is the default behavior
      
          for onError.
      
      
      
      - Removes all the existing exception handler callbacks.
      
      
      
      - Replaces all the existing places that described exceptions using
      
        debugPrint with calls to FlutterError.reportError().
      
      
      
      - Extend lockState() to also catch exceptions, so that we catch
      
        exceptions that happen during finalizers.
      
      
      
      - Make the test framework catch errors and treat them as failures.
      
      
      
      - Provide a mechanism to override this behavior in the test framework.
      
      
      
      - Make the tests that used to depend on the exception handler
      
        callbacks use this new mechanism.
      
      
      
      - Make pump() also support the phase argument.
      
      
      
      - Improve some tests using these new features.
      
      
      
      Fixes #2356, #2988, #2985, #2220.
      ee703da9
  22. 14 Mar, 2016 1 commit
  23. 12 Mar, 2016 3 commits
  24. 11 Mar, 2016 1 commit
    • Ian Hickson's avatar
      Enable ALL THE LINTS · 1b9cd520
      Ian Hickson authored
      Well, all the easy ones, anyway.
      
      For some reason `// ignore:` isn't working for me so I've disabled
      lints that need that. Also disabled those that require a ton of work
      (which I'm doing, but not in this PR, to keep it reviewable).
      
      This adds:
      - avoid_init_to_null
      - library_names
      - package_api_docs
      - package_names
      - package_prefixed_library_names
      - prefer_is_not_empty
      - sort_constructors_first
      - sort_unnamed_constructors_first
      - unnecessary_getters_setters
      1b9cd520
  25. 04 Mar, 2016 1 commit
  26. 13 Feb, 2016 1 commit
    • Hixie's avatar
      SizeObserver crusade: drawer · e5cf7fe3
      Hixie authored
      Drawer doesn't need a SizeObserver, since it only looks at the size
      in event handlers. It can just go and probe the tree to read the size.
      
      Also, change from using _kEdgeDragWidth to using _kWidth when figuring
      out how much of the drawer to show when dragging it from the edge, since
      that is more likely to match the drawer's width.
      e5cf7fe3
  27. 11 Feb, 2016 2 commits
    • Ian Hickson's avatar
      Ticker typedef had no defined return type · 4d90194e
      Ian Hickson authored
      4d90194e
    • Ian Hickson's avatar
      Clean up imports and exports. · a94999ba
      Ian Hickson authored
      Each layer is supposed to reexport the parts of the previous layer
      that are part of its API.
      
      - In painting.dart, export from dart:ui all the Canvas-related APIs
        that make sense to be used at higher levels, e.g. PaintingStyle.
      
      - Delete painting/shadows.dart. It was dead code.
      
      - In rendering/object.dart, export all of painting.dart.
      
      - In widgets/basic.dart, export all of painting.dart and
        animation.dart. Some classes in animation/ are renamed to make this
        less disruptive and confusing to the namespace.
      
      - Split out Stocks back into an import model rather than a part model,
        so that it's easier to manage its dependencies on a per-file basis.
      
      - Move Ticker to scheduler library.
      
      - Remove as many redundant imports as possible now.
      
      - Some minor nit picking cleanup in various files.
      a94999ba
  28. 28 Jan, 2016 1 commit
  29. 24 Jan, 2016 1 commit
  30. 07 Jan, 2016 1 commit
  31. 15 Dec, 2015 1 commit