Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
e5abd98c
E
engine
项目概览
sxychenjing
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
e5abd98c
编写于
4月 15, 2021
作者:
F
Ferhat
提交者:
GitHub
4月 15, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
migrate tests to nullsafe (#25616)
上级
65e36e43
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
41 addition
and
49 deletion
+41
-49
lib/web_ui/test/golden_tests/engine/backdrop_filter_golden_test.dart
...test/golden_tests/engine/backdrop_filter_golden_test.dart
+13
-14
lib/web_ui/test/golden_tests/engine/canvas_arc_golden_test.dart
...b_ui/test/golden_tests/engine/canvas_arc_golden_test.dart
+4
-5
lib/web_ui/test/golden_tests/engine/canvas_blend_golden_test.dart
...ui/test/golden_tests/engine/canvas_blend_golden_test.dart
+10
-11
lib/web_ui/test/golden_tests/engine/canvas_clip_path_test.dart
...eb_ui/test/golden_tests/engine/canvas_clip_path_test.dart
+6
-7
lib/web_ui/test/golden_tests/engine/canvas_context_test.dart
lib/web_ui/test/golden_tests/engine/canvas_context_test.dart
+4
-5
lib/web_ui/test/golden_tests/engine/screenshot.dart
lib/web_ui/test/golden_tests/engine/screenshot.dart
+1
-2
lib/web_ui/test/golden_tests/golden_failure_smoke_test.dart
lib/web_ui/test/golden_tests/golden_failure_smoke_test.dart
+1
-2
lib/web_ui/test/golden_tests/golden_success_smoke_test.dart
lib/web_ui/test/golden_tests/golden_success_smoke_test.dart
+2
-3
未找到文件。
lib/web_ui/test/golden_tests/engine/backdrop_filter_golden_test.dart
浏览文件 @
e5abd98c
...
...
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.6
import
'dart:html'
as
html
;
import
'package:test/bootstrap/browser.dart'
;
...
...
@@ -56,9 +55,9 @@ void testMain() async {
builder
.
pop
();
builder
.
pop
();
html
.
document
.
body
.
append
(
builder
html
.
document
.
body
!
.
append
(
builder
.
build
()
.
webOnlyRootElement
);
.
webOnlyRootElement
!
);
await
matchGoldenFile
(
'backdrop_filter_clip.png'
,
region:
region
,
maxDiffRatePercent:
0.8
);
...
...
@@ -107,9 +106,9 @@ void testMain() async {
builder2
.
pop
();
builder2
.
pop
();
html
.
document
.
body
.
append
(
builder2
html
.
document
.
body
!
.
append
(
builder2
.
build
()
.
webOnlyRootElement
);
.
webOnlyRootElement
!
);
await
matchGoldenFile
(
'backdrop_filter_clip_moved.png'
,
region:
region
,
maxDiffRatePercent:
0.8
);
...
...
@@ -139,9 +138,9 @@ void testMain() async {
builder
.
pop
();
builder
.
pop
();
html
.
document
.
body
.
append
(
builder
html
.
document
.
body
!
.
append
(
builder
.
build
()
.
webOnlyRootElement
);
.
webOnlyRootElement
!
);
await
matchGoldenFile
(
'backdrop_filter_no_child_rendering.png'
,
region:
region
,
maxDiffRatePercent:
0.8
);
...
...
@@ -149,39 +148,39 @@ void testMain() async {
}
Picture
_drawTestPictureWithCircles
(
Rect
region
,
double
offsetX
,
double
offsetY
)
{
final
EnginePictureRecorder
recorder
=
PictureRecorder
();
final
EnginePictureRecorder
recorder
=
PictureRecorder
()
as
EnginePictureRecorder
;
final
RecordingCanvas
canvas
=
recorder
.
beginRecording
(
region
);
canvas
.
drawCircle
(
Offset
(
offsetX
+
10
,
offsetY
+
10
),
10
,
Paint
()..
style
=
PaintingStyle
.
fill
);
Offset
(
offsetX
+
10
,
offsetY
+
10
),
10
,
Surface
Paint
()..
style
=
PaintingStyle
.
fill
);
canvas
.
drawCircle
(
Offset
(
offsetX
+
60
,
offsetY
+
10
),
10
,
Paint
()
Surface
Paint
()
..
style
=
PaintingStyle
.
fill
..
color
=
const
Color
.
fromRGBO
(
255
,
0
,
0
,
1
));
canvas
.
drawCircle
(
Offset
(
offsetX
+
10
,
offsetY
+
60
),
10
,
Paint
()
Surface
Paint
()
..
style
=
PaintingStyle
.
fill
..
color
=
const
Color
.
fromRGBO
(
0
,
255
,
0
,
1
));
canvas
.
drawCircle
(
Offset
(
offsetX
+
60
,
offsetY
+
60
),
10
,
Paint
()
Surface
Paint
()
..
style
=
PaintingStyle
.
fill
..
color
=
const
Color
.
fromRGBO
(
0
,
0
,
255
,
1
));
return
recorder
.
endRecording
();
}
Picture
_drawBackground
(
Rect
region
)
{
final
EnginePictureRecorder
recorder
=
PictureRecorder
();
final
EnginePictureRecorder
recorder
=
PictureRecorder
()
as
EnginePictureRecorder
;
final
RecordingCanvas
canvas
=
recorder
.
beginRecording
(
region
);
canvas
.
drawRect
(
region
.
deflate
(
8.0
),
Paint
()
Surface
Paint
()
..
style
=
PaintingStyle
.
fill
..
color
=
Color
(
0xFFE0FFE0
)
);
...
...
lib/web_ui/test/golden_tests/engine/canvas_arc_golden_test.dart
浏览文件 @
e5abd98c
...
...
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.6
import
'dart:html'
as
html
;
import
'dart:math'
as
math
;
import
'package:test/bootstrap/browser.dart'
;
...
...
@@ -19,7 +18,7 @@ void main() {
void
testMain
(
)
async
{
final
Rect
region
=
Rect
.
fromLTWH
(
0
,
0
,
400
,
600
);
BitmapCanvas
canvas
;
late
BitmapCanvas
canvas
;
setUp
(()
{
canvas
=
BitmapCanvas
(
region
,
RenderStrategy
());
...
...
@@ -48,7 +47,7 @@ void testMain() async {
largeArc:
true
,
clockwise:
true
,
distance:
-
20
);
html
.
document
.
body
.
append
(
canvas
.
rootElement
);
html
.
document
.
body
!
.
append
(
canvas
.
rootElement
);
await
matchGoldenFile
(
'canvas_arc_to_point.png'
,
region:
region
);
});
...
...
@@ -63,7 +62,7 @@ void testMain() async {
..
color
=
Color
(
0xFFFF9800
)
// orange
..
style
=
PaintingStyle
.
fill
);
html
.
document
.
body
.
append
(
canvas
.
rootElement
);
html
.
document
.
body
!
.
append
(
canvas
.
rootElement
);
await
matchGoldenFile
(
'canvas_addarc.png'
,
region:
region
);
});
...
...
@@ -81,7 +80,7 @@ void testMain() async {
..
color
=
Color
(
0xFFFF9800
)
// orange
..
style
=
PaintingStyle
.
fill
);
html
.
document
.
body
.
append
(
canvas
.
rootElement
);
html
.
document
.
body
!
.
append
(
canvas
.
rootElement
);
await
matchGoldenFile
(
'canvas_addarc_ccw.png'
,
region:
region
);
});
}
...
...
lib/web_ui/test/golden_tests/engine/canvas_blend_golden_test.dart
浏览文件 @
e5abd98c
...
...
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.6
import
'dart:html'
as
html
;
import
'dart:js_util'
as
js_util
;
...
...
@@ -35,7 +34,7 @@ void testMain() async {
final
html
.
Element
sceneElement
=
html
.
Element
.
tag
(
'flt-scene'
);
try
{
sceneElement
.
append
(
engineCanvas
.
rootElement
);
html
.
document
.
body
.
append
(
sceneElement
);
html
.
document
.
body
!
.
append
(
sceneElement
);
await
matchGoldenFile
(
'
$fileName
.png'
,
region:
region
,
maxDiffRatePercent:
maxDiffRatePercent
,
write:
write
);
}
finally
{
...
...
@@ -58,13 +57,13 @@ void testMain() async {
rc
.
save
();
rc
.
drawRect
(
Rect
.
fromLTRB
(
0
,
0
,
400
,
400
),
Paint
()
Surface
Paint
()
..
style
=
PaintingStyle
.
fill
..
color
=
const
Color
.
fromARGB
(
255
,
255
,
255
,
255
));
rc
.
drawCircle
(
Offset
(
100
,
100
),
80.0
,
Paint
()
Surface
Paint
()
..
style
=
PaintingStyle
.
fill
..
color
=
const
Color
.
fromARGB
(
128
,
255
,
0
,
0
)
..
blendMode
=
BlendMode
.
difference
);
...
...
@@ -72,7 +71,7 @@ void testMain() async {
rc
.
drawCircle
(
Offset
(
170
,
100
),
80.0
,
Paint
()
Surface
Paint
()
..
style
=
PaintingStyle
.
fill
..
blendMode
=
BlendMode
.
color
..
color
=
const
Color
.
fromARGB
(
128
,
0
,
255
,
0
));
...
...
@@ -80,7 +79,7 @@ void testMain() async {
rc
.
drawCircle
(
Offset
(
135
,
170
),
80.0
,
Paint
()
Surface
Paint
()
..
style
=
PaintingStyle
.
fill
..
color
=
const
Color
.
fromARGB
(
128
,
255
,
0
,
0
));
rc
.
restore
();
...
...
@@ -95,20 +94,20 @@ void testMain() async {
rc
.
save
();
rc
.
drawRect
(
Rect
.
fromLTRB
(
0
,
0
,
400
,
400
),
Paint
()
Surface
Paint
()
..
style
=
PaintingStyle
.
fill
..
color
=
const
Color
.
fromARGB
(
255
,
255
,
255
,
255
));
rc
.
drawCircle
(
Offset
(
100
,
100
),
80.0
,
Paint
()
Surface
Paint
()
..
style
=
PaintingStyle
.
fill
..
color
=
const
Color
.
fromARGB
(
128
,
255
,
0
,
0
)
..
blendMode
=
BlendMode
.
difference
);
rc
.
drawCircle
(
Offset
(
170
,
100
),
80.0
,
Paint
()
Surface
Paint
()
..
style
=
PaintingStyle
.
fill
..
blendMode
=
BlendMode
.
color
..
color
=
const
Color
.
fromARGB
(
128
,
0
,
255
,
0
));
...
...
@@ -116,11 +115,11 @@ void testMain() async {
rc
.
drawCircle
(
Offset
(
135
,
170
),
80.0
,
Paint
()
Surface
Paint
()
..
style
=
PaintingStyle
.
fill
..
color
=
const
Color
.
fromARGB
(
128
,
255
,
0
,
0
));
rc
.
drawImage
(
createTestImage
(),
Offset
(
135.0
,
130.0
),
Paint
()..
blendMode
=
BlendMode
.
multiply
);
Surface
Paint
()..
blendMode
=
BlendMode
.
multiply
);
rc
.
restore
();
await
_checkScreenshot
(
rc
,
'canvas_blend_image_multiply'
,
maxDiffRatePercent:
operatingSystem
==
OperatingSystem
.
macOs
?
2.95
:
...
...
lib/web_ui/test/golden_tests/engine/canvas_clip_path_test.dart
浏览文件 @
e5abd98c
...
...
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.6
import
'dart:html'
as
html
;
import
'dart:js_util'
as
js_util
;
...
...
@@ -42,7 +41,7 @@ void testMain() async {
path
.
addOval
(
Rect
.
fromLTWH
(
100
,
30
,
testWidth
,
testHeight
));
rc
.
clipPath
(
path
);
rc
.
drawImageRect
(
testImage
,
Rect
.
fromLTRB
(
0
,
0
,
testWidth
,
testHeight
),
Rect
.
fromLTWH
(
100
,
30
,
testWidth
,
testHeight
),
Paint
());
Rect
.
fromLTWH
(
100
,
30
,
testWidth
,
testHeight
),
engine
.
Surface
Paint
());
rc
.
restore
();
await
canvasScreenshot
(
rc
,
'image_clipped_by_oval'
,
region:
screenRect
);
...
...
@@ -65,7 +64,7 @@ void testMain() async {
paintPath
.
close
();
rc
.
drawPath
(
paintPath
,
Paint
()
engine
.
Surface
Paint
()
..
color
=
Color
(
0xFF00FF00
)
..
style
=
PaintingStyle
.
fill
);
rc
.
restore
();
...
...
@@ -85,7 +84,7 @@ void testMain() async {
paintPath
.
addRect
(
Rect
.
fromLTWH
(-
50
,
0
,
testWidth
,
testHeight
));
paintPath
.
close
();
rc
.
drawPath
(
paintPath
,
Paint
()
engine
.
Surface
Paint
()
..
color
=
Color
(
0xFF000000
)
..
style
=
PaintingStyle
.
stroke
);
...
...
@@ -96,7 +95,7 @@ void testMain() async {
path
.
close
();
rc
.
clipPath
(
path
);
rc
.
drawImageRect
(
createTestImage
(),
Rect
.
fromLTRB
(
0
,
0
,
testWidth
,
testHeight
),
Rect
.
fromLTWH
(-
50
,
0
,
testWidth
,
testHeight
),
Paint
());
Rect
.
fromLTWH
(-
50
,
0
,
testWidth
,
testHeight
),
engine
.
Surface
Paint
());
rc
.
restore
();
await
canvasScreenshot
(
rc
,
'image_clipped_by_triangle_off_screen'
);
});
...
...
@@ -113,7 +112,7 @@ void testMain() async {
paintPath
.
addRect
(
Rect
.
fromLTWH
(-
50
,
0
,
testWidth
,
testHeight
));
paintPath
.
close
();
rc
.
drawPath
(
paintPath
,
Paint
()
engine
.
Surface
Paint
()
..
color
=
Color
(
0xFF000000
)
..
style
=
PaintingStyle
.
stroke
);
...
...
@@ -121,7 +120,7 @@ void testMain() async {
path
.
addOval
(
Rect
.
fromLTRB
(-
200
,
0
,
100
,
150
));
rc
.
clipPath
(
path
);
rc
.
drawImageRect
(
createTestImage
(),
Rect
.
fromLTRB
(
0
,
0
,
testWidth
,
testHeight
),
Rect
.
fromLTWH
(-
50
,
0
,
testWidth
,
testHeight
),
Paint
());
Rect
.
fromLTWH
(-
50
,
0
,
testWidth
,
testHeight
),
engine
.
Surface
Paint
());
rc
.
restore
();
await
canvasScreenshot
(
rc
,
'image_clipped_by_oval_path'
);
});
...
...
lib/web_ui/test/golden_tests/engine/canvas_context_test.dart
浏览文件 @
e5abd98c
...
...
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.6
import
'dart:html'
as
html
;
import
'package:test/bootstrap/browser.dart'
;
...
...
@@ -35,7 +34,7 @@ void testMain() async {
final
html
.
Element
sceneElement
=
html
.
Element
.
tag
(
'flt-scene'
);
try
{
sceneElement
.
append
(
engineCanvas
.
rootElement
);
html
.
document
.
body
.
append
(
sceneElement
);
html
.
document
.
body
!
.
append
(
sceneElement
);
// TODO(yjbanov): 10% diff rate is excessive. Update goldens.
await
matchGoldenFile
(
'
$fileName
.png'
,
region:
region
,
maxDiffRatePercent:
10
);
}
finally
{
...
...
@@ -57,7 +56,7 @@ void testMain() async {
test
(
'Clips image with oval clip path'
,
()
async
{
final
engine
.
RecordingCanvas
rc
=
engine
.
RecordingCanvas
(
const
Rect
.
fromLTRB
(
0
,
0
,
400
,
300
));
final
Paint
paint
=
Paint
()
final
engine
.
SurfacePaint
paint
=
Paint
()
as
engine
.
SurfacePaint
..
color
=
Color
(
0xFF00FF00
)
..
style
=
PaintingStyle
.
fill
;
rc
.
save
();
...
...
@@ -98,11 +97,11 @@ void testMain() async {
rc
.
save
();
rc
.
restore
();
// The rectangle should be clipped against oval.
rc
.
drawRect
(
Rect
.
fromLTWH
(
0
,
0
,
300
,
300
),
badPaint
);
rc
.
drawRect
(
Rect
.
fromLTWH
(
0
,
0
,
300
,
300
),
badPaint
as
engine
.
SurfacePaint
);
rc
.
restore
();
// The rectangle should paint without clipping since we restored
// context.
rc
.
drawRect
(
Rect
.
fromLTWH
(
0
,
0
,
200
,
200
),
goodPaint
);
rc
.
drawRect
(
Rect
.
fromLTWH
(
0
,
0
,
200
,
200
),
goodPaint
as
engine
.
SurfacePaint
);
await
_checkScreenshot
(
rc
,
'context_save_restore_clip'
);
});
}
lib/web_ui/test/golden_tests/engine/screenshot.dart
浏览文件 @
e5abd98c
...
...
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.6
import
'dart:html'
as
html
;
import
'package:ui/ui.dart'
as
ui
;
import
'package:ui/src/engine.dart'
;
...
...
@@ -23,7 +22,7 @@ Future<void> canvasScreenshot(RecordingCanvas rc, String fileName,
final
html
.
Element
sceneElement
=
html
.
Element
.
tag
(
'flt-scene'
);
try
{
sceneElement
.
append
(
engineCanvas
.
rootElement
);
html
.
document
.
body
.
append
(
sceneElement
);
html
.
document
.
body
!
.
append
(
sceneElement
);
await
matchGoldenFile
(
'
$fileName
.png'
,
region:
region
,
maxDiffRatePercent:
maxDiffRatePercent
,
write:
write
);
}
finally
{
...
...
lib/web_ui/test/golden_tests/golden_failure_smoke_test.dart
浏览文件 @
e5abd98c
...
...
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.6
import
'dart:html'
as
html
;
import
'package:test/bootstrap/browser.dart'
;
...
...
@@ -16,7 +15,7 @@ void main() {
void
testMain
(
)
{
test
(
'screenshot test reports failure'
,
()
async
{
html
.
document
.
body
.
innerHtml
=
'Text that does not appear on the screenshot!'
;
html
.
document
.
body
!
.
innerHtml
=
'Text that does not appear on the screenshot!'
;
await
matchGoldenFile
(
'__local__/smoke_test.png'
,
region:
Rect
.
fromLTWH
(
0
,
0
,
320
,
200
));
});
}
lib/web_ui/test/golden_tests/golden_success_smoke_test.dart
浏览文件 @
e5abd98c
...
...
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.6
import
'dart:html'
as
html
;
import
'package:test/bootstrap/browser.dart'
;
...
...
@@ -20,8 +19,8 @@ void testMain() async {
await
webOnlyInitializePlatform
(
assetManager:
WebOnlyMockAssetManager
());
test
(
'screenshot test reports success'
,
()
async
{
html
.
document
.
body
.
style
.
fontFamily
=
'Roboto'
;
html
.
document
.
body
.
innerHtml
=
'Hello world!'
;
html
.
document
.
body
!
.
style
.
fontFamily
=
'Roboto'
;
html
.
document
.
body
!
.
innerHtml
=
'Hello world!'
;
// TODO: https://github.com/flutter/flutter/issues/74702 , reduce webkit percentage.
await
matchGoldenFile
(
'__local__/smoke_test.png'
,
region:
Rect
.
fromLTWH
(
0
,
0
,
320
,
200
),
maxDiffRatePercent:
browserEngine
==
BrowserEngine
.
webkit
?
3.0
:
0.28
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录