Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
903ebd71
Unverified
Commit
903ebd71
authored
Oct 25, 2019
by
Yegor
Committed by
GitHub
Oct 25, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix and enable most of material tests for Web (#43019)
parent
41c02d71
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
125 additions
and
40 deletions
+125
-40
.cirrus.yml
.cirrus.yml
+19
-7
test.dart
dev/bots/test.dart
+6
-2
slider_theme.dart
packages/flutter/lib/src/material/slider_theme.dart
+7
-0
paginated_data_table_test.dart
...ages/flutter/test/material/paginated_data_table_test.dart
+1
-1
slider_theme_test.dart
packages/flutter/test/material/slider_theme_test.dart
+31
-3
build_script.dart
...ages/flutter_tools/lib/src/build_runner/build_script.dart
+1
-1
web_compilation_delegate.dart
..._tools/lib/src/build_runner/web_compilation_delegate.dart
+9
-1
web_fs.dart
packages/flutter_tools/lib/src/build_runner/web_fs.dart
+48
-24
flutter_web_platform.dart
...ages/flutter_tools/lib/src/test/flutter_web_platform.dart
+1
-1
runner.dart
packages/flutter_tools/lib/src/test/runner.dart
+1
-0
compile.dart
packages/flutter_tools/lib/src/web/compile.dart
+1
-0
No files found.
.cirrus.yml
View file @
903ebd71
...
...
@@ -150,7 +150,6 @@ task:
# As of October 2019, the Web shards needed more than 6G of RAM.
CPU
:
2
MEMORY
:
8G
allow_failures
:
true
script
:
-
dart --enable-asserts ./dev/bots/test.dart
...
...
@@ -160,7 +159,6 @@ task:
# As of October 2019, the Web shards needed more than 6G of RAM.
CPU
:
2
MEMORY
:
8G
allow_failures
:
true
script
:
-
dart --enable-asserts ./dev/bots/test.dart
...
...
@@ -170,7 +168,6 @@ task:
# As of October 2019, the Web shards needed more than 6G of RAM.
CPU
:
2
MEMORY
:
8G
allow_failures
:
true
script
:
-
dart --enable-asserts ./dev/bots/test.dart
...
...
@@ -180,7 +177,6 @@ task:
# As of October 2019, the Web shards needed more than 6G of RAM.
CPU
:
2
MEMORY
:
8G
allow_failures
:
true
script
:
-
dart --enable-asserts ./dev/bots/test.dart
...
...
@@ -190,17 +186,33 @@ task:
# As of October 2019, the Web shards needed more than 6G of RAM.
CPU
:
2
MEMORY
:
8G
allow_failures
:
true
script
:
-
dart --enable-asserts ./dev/bots/test.dart
-
name
:
web_tests-5_last-linux
# last Web shard must end with _last
-
name
:
web_tests-5-linux
only_if
:
"
changesInclude('.cirrus.yml',
'dev/**',
'packages/flutter/**',
'packages/flutter_test/**',
'packages/flutter_tools/lib/src/test/**',
'packages/flutter_web_plugins/**',
'bin/internal/**')
||
$CIRRUS_PR
==
''"
environment
:
# As of October 2019, the Web shards needed more than 6G of RAM.
CPU
:
2
MEMORY
:
8G
script
:
-
dart --enable-asserts ./dev/bots/test.dart
-
name
:
web_tests-6-linux
only_if
:
"
changesInclude('.cirrus.yml',
'dev/**',
'packages/flutter/**',
'packages/flutter_test/**',
'packages/flutter_tools/lib/src/test/**',
'packages/flutter_web_plugins/**',
'bin/internal/**')
||
$CIRRUS_PR
==
''"
environment
:
# As of October 2019, the Web shards needed more than 6G of RAM.
CPU
:
2
MEMORY
:
8G
script
:
-
dart --enable-asserts ./dev/bots/test.dart
-
name
:
web_tests-7_last-linux
# last Web shard must end with _last
only_if
:
"
changesInclude('.cirrus.yml',
'dev/**',
'packages/flutter/**',
'packages/flutter_test/**',
'packages/flutter_tools/lib/src/test/**',
'packages/flutter_web_plugins/**',
'bin/internal/**')
||
$CIRRUS_PR
==
''"
environment
:
# As of October 2019, the Web shards needed more than 6G of RAM.
CPU
:
2
MEMORY
:
8G
allow_failures
:
true
script
:
-
dart --enable-asserts ./dev/bots/test.dart
...
...
dev/bots/test.dart
View file @
903ebd71
...
...
@@ -50,7 +50,7 @@ const int kDeviceLabShardCount = 4;
/// and make sure it runs _all_ shards.
///
/// The last shard also runs the Web plugin tests.
const
int
kWebShardCount
=
6
;
const
int
kWebShardCount
=
8
;
/// Maximum number of Web tests to run in a single `flutter test`. We found that
/// large batches can get flaky, possibly because we reuse a single instance of
...
...
@@ -63,7 +63,6 @@ const int kWebBatchSize = 20;
const
List
<
String
>
kWebTestDirectoryBlacklist
=
<
String
>[
'cupertino'
,
'examples'
,
'material'
,
];
const
List
<
String
>
kWebTestFileBlacklist
=
<
String
>[
'test/widgets/heroes_test.dart'
,
...
...
@@ -77,6 +76,11 @@ const List<String> kWebTestFileBlacklist = <String>[
'test/widgets/widget_inspector_test.dart'
,
'test/widgets/draggable_test.dart'
,
'test/widgets/shortcuts_test.dart'
,
'test/material/text_form_field_test.dart'
,
'test/material/banner_theme_test.dart'
,
'test/material/popup_menu_test.dart'
,
'test/material/data_table_test.dart'
,
'test/material/toggle_buttons_test.dart'
,
];
/// When you call this, you can pass additional arguments to pass custom
...
...
packages/flutter/lib/src/material/slider_theme.dart
View file @
903ebd71
...
...
@@ -2620,6 +2620,7 @@ class _PaddleSliderTrackShapePathPainter {
// Adds an arc to the path that has the attributes passed in. This is
// a convenience to make adding arcs have less boilerplate.
static
void
_addArc
(
Path
path
,
Offset
center
,
double
radius
,
double
startAngle
,
double
endAngle
)
{
assert
(
center
.
isFinite
);
final
Rect
arcRect
=
Rect
.
fromCircle
(
center:
center
,
radius:
radius
);
path
.
arcTo
(
arcRect
,
startAngle
,
endAngle
-
startAngle
,
false
);
}
...
...
@@ -2692,6 +2693,12 @@ class _PaddleSliderTrackShapePathPainter {
TextPainter
labelPainter
,
Color
strokePaintColor
,
)
{
if
(
scale
==
0.0
)
{
// Zero scale essentially means "do not draw anything", so it's safe to just return. Otherwise,
// our math below will attempt to divide by zero and send needless NaNs to the engine.
return
;
}
// The entire value indicator should scale with the size of the label,
// to keep it large enough to encompass the label text.
final
double
textScaleFactor
=
labelPainter
.
height
/
_labelTextDesignSize
;
...
...
packages/flutter/test/material/paginated_data_table_test.dart
View file @
903ebd71
...
...
@@ -259,7 +259,7 @@ void main() {
expect
(
find
.
text
(
'501'
),
findsOneWidget
);
// Test that it fits:
expect
(
tester
.
getTopRight
(
find
.
text
(
'501'
)).
dx
,
greaterThanOrEqualTo
(
tester
.
getTopRight
(
find
.
text
(
'Rows per page:'
)).
dx
+
40.0
));
}
);
}
,
skip:
isBrowser
);
// TODO(yjbanov): https://github.com/flutter/flutter/issues/43433
testWidgets
(
'PaginatedDataTable footer scrolls'
,
(
WidgetTester
tester
)
async
{
final
TestDataSource
source
=
TestDataSource
();
...
...
packages/flutter/test/material/slider_theme_test.dart
View file @
903ebd71
...
...
@@ -814,9 +814,39 @@ void main() {
await
gesture
.
up
();
});
}
testWidgets
(
'PaddleRangeSliderValueIndicatorShape skips all painting at zero scale'
,
(
WidgetTester
tester
)
async
{
// Pump a slider with just a value indicator.
await
tester
.
pumpWidget
(
_buildApp
(
ThemeData
().
sliderTheme
.
copyWith
(
trackHeight:
0
,
overlayShape:
SliderComponentShape
.
noOverlay
,
thumbShape:
SliderComponentShape
.
noThumb
,
tickMarkShape:
SliderTickMarkShape
.
noTickMark
,
showValueIndicator:
ShowValueIndicator
.
always
,
rangeValueIndicatorShape:
const
PaddleRangeSliderValueIndicatorShape
(),
),
value:
0.5
,
divisions:
4
,
));
final
RenderBox
sliderBox
=
tester
.
firstRenderObject
<
RenderBox
>(
find
.
byType
(
Slider
));
// Tap the center of the track to kick off the animation of the value indicator.
final
Offset
center
=
tester
.
getCenter
(
find
.
byType
(
Slider
));
final
TestGesture
gesture
=
await
tester
.
startGesture
(
center
);
// Nothing to paint at scale 0.
await
tester
.
pump
();
expect
(
sliderBox
,
paintsNothing
);
// Painting a path for the value indicator.
await
tester
.
pump
(
const
Duration
(
milliseconds:
16
));
expect
(
sliderBox
,
paintsExactlyCountTimes
(
#drawPath
,
1
));
await
gesture
.
up
();
});
}
Widget
_buildApp
(
SliderThemeData
sliderTheme
,
{
...
...
@@ -841,5 +871,3 @@ Widget _buildApp(
),
);
}
packages/flutter_tools/lib/src/build_runner/build_script.dart
View file @
903ebd71
...
...
@@ -278,7 +278,7 @@ Future<void> main() async {
// we don't have an embedder yet this is the lowest-most layer we can put
// this stuff in.
ui
.
debugEmulateFlutterTesterEnvironment
=
true
;
await
ui
.
webOnlyInitialize
Engine
();
await
ui
.
webOnlyInitialize
Platform
();
// TODO(flutterweb): remove need for dynamic cast.
(
ui
.
window
as
dynamic
).
debugOverrideDevicePixelRatio
(
3.0
);
(
ui
.
window
as
dynamic
).
webOnlyDebugPhysicalSizeOverride
=
const
ui
.
Size
(
2400
,
1800
);
...
...
packages/flutter_tools/lib/src/build_runner/web_compilation_delegate.dart
View file @
903ebd71
...
...
@@ -30,6 +30,7 @@ class BuildRunnerWebCompilationProxy extends WebCompilationProxy {
Future
<
bool
>
initialize
({
Directory
projectDirectory
,
String
testOutputDir
,
List
<
String
>
testFiles
,
BuildMode
mode
,
String
projectName
,
bool
initializePlatform
,
...
...
@@ -46,8 +47,15 @@ class BuildRunnerWebCompilationProxy extends WebCompilationProxy {
release:
mode
==
BuildMode
.
release
,
profile:
mode
==
BuildMode
.
profile
,
hasPlugins:
hasWebPlugins
,
includeTests:
true
,
initializePlatform:
initializePlatform
,
testTargets:
WebTestTargetManifest
(
testFiles
.
map
<
String
>((
String
absolutePath
)
{
final
String
relativePath
=
path
.
relative
(
absolutePath
,
from:
projectDirectory
.
path
);
return
'
${path.withoutExtension(relativePath)}
.*'
;
})
.
toList
(),
),
);
client
.
startBuild
();
bool
success
=
true
;
...
...
packages/flutter_tools/lib/src/build_runner/web_fs.dart
View file @
903ebd71
...
...
@@ -531,6 +531,16 @@ class ConnectionResult {
final
DebugConnection
debugConnection
;
}
class
WebTestTargetManifest
{
WebTestTargetManifest
(
this
.
buildFilters
);
WebTestTargetManifest
.
all
()
:
buildFilters
=
null
;
final
List
<
String
>
buildFilters
;
bool
get
hasBuildFilters
=>
buildFilters
!=
null
&&
buildFilters
.
isNotEmpty
;
}
/// A testable interface for starting a build daemon.
class
BuildDaemonCreator
{
const
BuildDaemonCreator
();
...
...
@@ -547,8 +557,8 @@ class BuildDaemonCreator {
bool
release
=
false
,
bool
profile
=
false
,
bool
hasPlugins
=
false
,
bool
includeTests
=
false
,
bool
initializePlatform
=
true
,
WebTestTargetManifest
testTargets
,
})
async
{
try
{
final
BuildDaemonClient
client
=
await
_connectClient
(
...
...
@@ -557,8 +567,9 @@ class BuildDaemonCreator {
profile:
profile
,
hasPlugins:
hasPlugins
,
initializePlatform:
initializePlatform
,
testTargets:
testTargets
,
);
_registerBuildTargets
(
client
,
includeTes
ts
);
_registerBuildTargets
(
client
,
testTarge
ts
);
return
client
;
}
on
OptionsSkew
{
throwToolExit
(
...
...
@@ -571,7 +582,7 @@ class BuildDaemonCreator {
void
_registerBuildTargets
(
BuildDaemonClient
client
,
bool
includeTes
ts
,
WebTestTargetManifest
testTarge
ts
,
)
{
final
OutputLocation
outputLocation
=
OutputLocation
((
OutputLocationBuilder
b
)
=>
b
..
output
=
''
...
...
@@ -580,10 +591,15 @@ class BuildDaemonCreator {
client
.
registerBuildTarget
(
DefaultBuildTarget
((
DefaultBuildTargetBuilder
b
)
=>
b
..
target
=
'web'
..
outputLocation
=
outputLocation
?.
toBuilder
()));
if
(
includeTests
)
{
client
.
registerBuildTarget
(
DefaultBuildTarget
((
DefaultBuildTargetBuilder
b
)
=>
b
..
target
=
'test'
..
outputLocation
=
outputLocation
?.
toBuilder
()));
if
(
testTargets
!=
null
)
{
client
.
registerBuildTarget
(
DefaultBuildTarget
((
DefaultBuildTargetBuilder
b
)
{
b
.
target
=
'test'
;
b
.
outputLocation
=
outputLocation
?.
toBuilder
();
if
(
testTargets
.
hasBuildFilters
)
{
b
.
buildFilters
.
addAll
(
testTargets
.
buildFilters
);
}
return
b
;
}));
}
}
...
...
@@ -593,29 +609,37 @@ class BuildDaemonCreator {
bool
profile
,
bool
hasPlugins
,
bool
initializePlatform
,
WebTestTargetManifest
testTargets
,
})
{
final
String
flutterToolsPackages
=
fs
.
path
.
join
(
Cache
.
flutterRoot
,
'packages'
,
'flutter_tools'
,
'.packages'
);
final
String
buildScript
=
fs
.
path
.
join
(
Cache
.
flutterRoot
,
'packages'
,
'flutter_tools'
,
'lib'
,
'src'
,
'build_runner'
,
'build_script.dart'
);
final
String
flutterWebSdk
=
artifacts
.
getArtifactPath
(
Artifact
.
flutterWebSdk
);
// On Windows we need to call the snapshot directly otherwise
// the process will start in a disjoint cmd without access to
// STDIO.
final
List
<
String
>
args
=
<
String
>[
artifacts
.
getArtifactPath
(
Artifact
.
engineDartBinary
),
'--packages=
$flutterToolsPackages
'
,
buildScript
,
'daemon'
,
'--skip-build-script-check'
,
'--define'
,
'flutter_tools:ddc=flutterWebSdk=
$flutterWebSdk
'
,
'--define'
,
'flutter_tools:entrypoint=flutterWebSdk=
$flutterWebSdk
'
,
'--define'
,
'flutter_tools:entrypoint=release=
$release
'
,
'--define'
,
'flutter_tools:entrypoint=profile=
$profile
'
,
'--define'
,
'flutter_tools:shell=flutterWebSdk=
$flutterWebSdk
'
,
'--define'
,
'flutter_tools:shell=hasPlugins=
$hasPlugins
'
,
'--define'
,
'flutter_tools:shell=initializePlatform=
$initializePlatform
'
,
// The following will cause build runner to only build tests that were requested.
if
(
testTargets
!=
null
&&
testTargets
.
hasBuildFilters
)
for
(
String
buildFilter
in
testTargets
.
buildFilters
)
'--build-filter=
$buildFilter
'
,
];
return
BuildDaemonClient
.
connect
(
workingDirectory
,
// On Windows we need to call the snapshot directly otherwise
// the process will start in a disjoint cmd without access to
// STDIO.
<
String
>[
artifacts
.
getArtifactPath
(
Artifact
.
engineDartBinary
),
'--packages=
$flutterToolsPackages
'
,
buildScript
,
'daemon'
,
'--skip-build-script-check'
,
'--define'
,
'flutter_tools:ddc=flutterWebSdk=
$flutterWebSdk
'
,
'--define'
,
'flutter_tools:entrypoint=flutterWebSdk=
$flutterWebSdk
'
,
'--define'
,
'flutter_tools:entrypoint=release=
$release
'
,
'--define'
,
'flutter_tools:entrypoint=profile=
$profile
'
,
'--define'
,
'flutter_tools:shell=flutterWebSdk=
$flutterWebSdk
'
,
'--define'
,
'flutter_tools:shell=hasPlugins=
$hasPlugins
'
,
'--define'
,
'flutter_tools:shell=initializePlatform=
$initializePlatform
'
,
],
args
,
logHandler:
(
ServerLog
serverLog
)
{
switch
(
serverLog
.
level
)
{
case
Level
.
SEVERE
:
...
...
packages/flutter_tools/lib/src/test/flutter_web_platform.dart
View file @
903ebd71
...
...
@@ -139,7 +139,7 @@ class FlutterWebPlatform extends PlatformPlugin {
requireJs
.
openRead
(),
headers:
<
String
,
String
>{
'Content-Type'
:
'text/javascript'
},
);
}
else
if
(
request
.
requestedUri
.
path
.
contains
(
'
A
hem.ttf'
))
{
}
else
if
(
request
.
requestedUri
.
path
.
contains
(
'
a
hem.ttf'
))
{
return
shelf
.
Response
.
ok
(
ahem
.
openRead
());
}
else
if
(
request
.
requestedUri
.
path
.
contains
(
'dart_sdk.js'
))
{
return
shelf
.
Response
.
ok
(
...
...
packages/flutter_tools/lib/src/test/runner.dart
View file @
903ebd71
...
...
@@ -71,6 +71,7 @@ Future<int> runTests(
final
bool
result
=
await
webCompilationProxy
.
initialize
(
projectDirectory:
flutterProject
.
directory
,
testOutputDir:
tempBuildDir
,
testFiles:
testFiles
,
projectName:
flutterProject
.
manifest
.
appName
,
initializePlatform:
true
,
);
...
...
packages/flutter_tools/lib/src/web/compile.dart
View file @
903ebd71
...
...
@@ -75,6 +75,7 @@ class WebCompilationProxy {
@required
Directory
projectDirectory
,
@required
String
projectName
,
String
testOutputDir
,
List
<
String
>
testFiles
,
BuildMode
mode
,
bool
initializePlatform
,
})
async
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment