Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_34031325
engine
提交
cd77e784
E
engine
项目概览
qq_34031325
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
未验证
提交
cd77e784
编写于
2月 14, 2020
作者:
F
Ferhat
提交者:
GitHub
2月 14, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix drawRRect failure when shader is specified (#16601)
上级
8b0b6490
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
73 addition
and
2 deletion
+73
-2
lib/web_ui/dev/goldens_lock.yaml
lib/web_ui/dev/goldens_lock.yaml
+1
-1
lib/web_ui/lib/src/engine/surface/recording_canvas.dart
lib/web_ui/lib/src/engine/surface/recording_canvas.dart
+1
-1
lib/web_ui/test/golden_tests/engine/linear_gradient_golden_test.dart
...test/golden_tests/engine/linear_gradient_golden_test.dart
+71
-0
未找到文件。
lib/web_ui/dev/goldens_lock.yaml
浏览文件 @
cd77e784
repository
:
https://github.com/flutter/goldens.git
revision
:
956d4e1862b108b31afd06cbf0a767cefc72f4c5
revision
:
1699ba6fd7093a0a610f82618fa30546e7974777
lib/web_ui/lib/src/engine/surface/recording_canvas.dart
浏览文件 @
cd77e784
...
...
@@ -228,7 +228,7 @@ class RecordingCanvas {
}
void
drawRRect
(
ui
.
RRect
rrect
,
SurfacePaint
paint
)
{
if
(!
rrect
.
webOnlyUniformRadii
)
{
if
(
paint
.
shader
!=
null
||
!
rrect
.
webOnlyUniformRadii
)
{
_hasArbitraryPaint
=
true
;
}
_didDraw
=
true
;
...
...
lib/web_ui/test/golden_tests/engine/linear_gradient_golden_test.dart
0 → 100644
浏览文件 @
cd77e784
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:html'
as
html
;
import
'package:ui/ui.dart'
hide
TextStyle
;
import
'package:ui/src/engine.dart'
;
import
'package:test/test.dart'
;
import
'package:web_engine_tester/golden_tester.dart'
;
void
main
(
)
async
{
const
double
screenWidth
=
600.0
;
const
double
screenHeight
=
800.0
;
const
Rect
screenRect
=
Rect
.
fromLTWH
(
0
,
0
,
screenWidth
,
screenHeight
);
// Commit a recording canvas to a bitmap, and compare with the expected
Future
<
void
>
_checkScreenshot
(
RecordingCanvas
rc
,
String
fileName
,
{
Rect
region
=
const
Rect
.
fromLTWH
(
0
,
0
,
500
,
500
),
bool
write
=
false
})
async
{
final
EngineCanvas
engineCanvas
=
BitmapCanvas
(
screenRect
);
rc
.
apply
(
engineCanvas
);
// Wrap in <flt-scene> so that our CSS selectors kick in.
final
html
.
Element
sceneElement
=
html
.
Element
.
tag
(
'flt-scene'
);
try
{
sceneElement
.
append
(
engineCanvas
.
rootElement
);
html
.
document
.
body
.
append
(
sceneElement
);
await
matchGoldenFile
(
'
$fileName
.png'
,
region:
region
);
}
finally
{
// The page is reused across tests, so remove the element after taking the
// golden screenshot.
sceneElement
.
remove
();
}
}
setUp
(()
async
{
debugEmulateFlutterTesterEnvironment
=
true
;
await
webOnlyInitializePlatform
();
webOnlyFontCollection
.
debugRegisterTestFonts
();
await
webOnlyFontCollection
.
ensureFontsLoaded
();
});
test
(
'Should draw linear gradient using rectangle.'
,
()
async
{
final
RecordingCanvas
rc
=
RecordingCanvas
(
const
Rect
.
fromLTRB
(
0
,
0
,
500
,
500
));
Rect
shaderRect
=
const
Rect
.
fromLTRB
(
50
,
50
,
300
,
300
);
final
Paint
paint
=
Paint
()..
shader
=
Gradient
.
linear
(
Offset
(
shaderRect
.
left
,
shaderRect
.
top
),
Offset
(
shaderRect
.
right
,
shaderRect
.
bottom
),
[
Color
(
0xFFcfdfd2
),
Color
(
0xFF042a85
)]);
rc
.
drawRect
(
shaderRect
,
paint
);
expect
(
rc
.
hasArbitraryPaint
,
isTrue
);
await
_checkScreenshot
(
rc
,
'linear_gradient_rect'
);
});
// Regression test for https://github.com/flutter/flutter/issues/50010
test
(
'Should draw linear gradient using rounded rect.'
,
()
async
{
final
RecordingCanvas
rc
=
RecordingCanvas
(
const
Rect
.
fromLTRB
(
0
,
0
,
500
,
500
));
Rect
shaderRect
=
const
Rect
.
fromLTRB
(
50
,
50
,
300
,
300
);
final
Paint
paint
=
Paint
()..
shader
=
Gradient
.
linear
(
Offset
(
shaderRect
.
left
,
shaderRect
.
top
),
Offset
(
shaderRect
.
right
,
shaderRect
.
bottom
),
[
Color
(
0xFFcfdfd2
),
Color
(
0xFF042a85
)]);
rc
.
drawRRect
(
RRect
.
fromRectAndRadius
(
shaderRect
,
Radius
.
circular
(
16
)),
paint
);
expect
(
rc
.
hasArbitraryPaint
,
isTrue
);
await
_checkScreenshot
(
rc
,
'linear_gradient_rounded_rect'
);
});
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录