Skip to content

Commit

Permalink
Reland "Remove dual_screen from new_gallery integration test" (#150873)
Browse files Browse the repository at this point in the history
Relands flutter/flutter#150808

The original version of the pr [accidentally deleted the back button](flutter/flutter#150808 (comment)), which didn't block the app building but made the test hang because it couldn't back out of the demo pages.

Repro-ed the failure, and then tested that 
```
new_gallery_opengles_impeller__transition_perf
new_gallery__transition_perf
new_gallery_impeller_old_zoom__transition_perf
new_gallery__crane_perf
new_gallery_impeller__transition_perf
```

All pass on my pixel 7 pro, with ` dart bin/test_runner.dart test -t <test>`, after re-adding the mistakenly deleted content.

Did not test on an iOS device (I don't have one), but those tests were failing for the same reason from what I can tell:
```
> reply@study
[2024-06-26 12:49:21.884543] [STDOUT] stdout: [        ] scrolling to demo
[2024-06-26 12:49:22.412479] [STDOUT] stdout: [ +527 ms] tapping demo
[2024-06-26 12:49:28.075978] [STDOUT] stderr: [+5663 ms] VMServiceFlutterDriver: tap message is taking a long time to complete...
```
Which is the same error, and which makes sense - they got stuck because they couldn't back out of the page.

Sorry for the churn �
  • Loading branch information
gmackall authored Jun 26, 2024
1 parent c946a5a commit 0198afa
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 433 deletions.
50 changes: 0 additions & 50 deletions dev/integration_tests/new_gallery/lib/data/demos.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ import '../demos/reference/motion_demo_shared_y_axis_transition.dart';
import '../demos/reference/motion_demo_shared_z_axis_transition.dart';
import '../demos/reference/transformations_demo.dart'
deferred as transformations_demo;
import '../demos/reference/two_pane_demo.dart'
deferred as twopane_demo;
import '../demos/reference/typography_demo.dart'
deferred as typography;
import '../gallery_localizations.dart';
Expand Down Expand Up @@ -1158,54 +1156,6 @@ class Demos {

static List<GalleryDemo> otherDemos(GalleryLocalizations localizations) {
return <GalleryDemo>[
GalleryDemo(
title: localizations.demoTwoPaneTitle,
icon: GalleryIcons.bottomSheetPersistent,
slug: 'two-pane',
subtitle: localizations.demoTwoPaneSubtitle,
configurations: <GalleryDemoConfiguration>[
GalleryDemoConfiguration(
title: localizations.demoTwoPaneFoldableLabel,
description: localizations.demoTwoPaneFoldableDescription,
documentationUrl:
'https://pub.dev/documentation/dual_screen/latest/dual_screen/TwoPane-class.html',
buildRoute: (_) => DeferredWidget(
twopane_demo.loadLibrary,
() => twopane_demo.TwoPaneDemo(
type: twopane_demo.TwoPaneDemoType.foldable,
restorationId: 'two_pane_foldable',
),
),
),
GalleryDemoConfiguration(
title: localizations.demoTwoPaneTabletLabel,
description: localizations.demoTwoPaneTabletDescription,
documentationUrl:
'https://pub.dev/documentation/dual_screen/latest/dual_screen/TwoPane-class.html',
buildRoute: (_) => DeferredWidget(
twopane_demo.loadLibrary,
() => twopane_demo.TwoPaneDemo(
type: twopane_demo.TwoPaneDemoType.tablet,
restorationId: 'two_pane_tablet',
),
),
),
GalleryDemoConfiguration(
title: localizations.demoTwoPaneSmallScreenLabel,
description: localizations.demoTwoPaneSmallScreenDescription,
documentationUrl:
'https://pub.dev/documentation/dual_screen/latest/dual_screen/TwoPane-class.html',
buildRoute: (_) => DeferredWidget(
twopane_demo.loadLibrary,
() => twopane_demo.TwoPaneDemo(
type: twopane_demo.TwoPaneDemoType.smallScreen,
restorationId: 'two_pane_single',
),
),
),
],
category: GalleryDemoCategory.other,
),
GalleryDemo(
title: localizations.demoMotionTitle,
icon: GalleryIcons.animation,
Expand Down

This file was deleted.

20 changes: 1 addition & 19 deletions dev/integration_tests/new_gallery/lib/layout/adaptive.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,20 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'dart:ui';

import 'package:adaptive_breakpoints/adaptive_breakpoints.dart';
import 'package:dual_screen/dual_screen.dart';
import 'package:flutter/material.dart';

/// The maximum width taken up by each item on the home screen.
const double maxHomeItemWidth = 1400.0;

/// Returns a boolean value whether the window is considered medium or large size.
///
/// When running on a desktop device that is also foldable, the display is not
/// considered desktop. Widgets using this method might consider the display is
/// Widgets using this method might consider the display is
/// large enough for certain layouts, which is not the case on foldable devices,
/// where only part of the display is available to said widgets.
///
/// Used to build adaptive and responsive layouts.
bool isDisplayDesktop(BuildContext context) =>
!isDisplayFoldable(context) &&
getWindowType(context) >= AdaptiveWindowType.medium;

/// Returns boolean value whether the window is considered medium size.
Expand All @@ -29,16 +24,3 @@ bool isDisplayDesktop(BuildContext context) =>
bool isDisplaySmallDesktop(BuildContext context) {
return getWindowType(context) == AdaptiveWindowType.medium;
}

/// Returns a boolean value whether the display has a hinge that splits the
/// screen into two, left and right sub-screens. Horizontal splits (top and
/// bottom sub-screens) are ignored for this application.
bool isDisplayFoldable(BuildContext context) {
final DisplayFeature? hinge = MediaQuery.of(context).hinge;
if (hinge == null) {
return false;
} else {
// Vertical
return hinge.bounds.size.aspectRatio < 1;
}
}
4 changes: 1 addition & 3 deletions dev/integration_tests/new_gallery/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:dual_screen/dual_screen.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart' show timeDilation;
Expand Down Expand Up @@ -50,7 +49,6 @@ class GalleryApp extends StatelessWidget {
child: Builder(
builder: (BuildContext context) {
final GalleryOptions options = GalleryOptions.of(context);
final bool hasHinge = MediaQuery.of(context).hinge?.bounds != null;
return MaterialApp(
restorationScopeId: 'rootGallery',
title: 'Flutter Gallery',
Expand All @@ -74,7 +72,7 @@ class GalleryApp extends StatelessWidget {
return basicLocaleListResolution(locales, supportedLocales);
},
onGenerateRoute: (RouteSettings settings) =>
RouteConfiguration.onGenerateRoute(settings, hasHinge),
RouteConfiguration.onGenerateRoute(settings),
);
},
),
Expand Down
Loading

0 comments on commit 0198afa

Please sign in to comment.