• 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
assertions.dart 14.3 KB