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
b5932065
Unverified
Commit
b5932065
authored
Aug 20, 2021
by
nt4f04uNd
Committed by
GitHub
Aug 20, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure RawImage render object updates (#88369)
parent
65deca30
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
96 additions
and
4 deletions
+96
-4
basic.dart
packages/flutter/lib/src/widgets/basic.dart
+4
-2
basic_test.dart
packages/flutter/test/widgets/basic_test.dart
+92
-2
No files found.
packages/flutter/lib/src/widgets/basic.dart
View file @
b5932065
...
...
@@ -6139,8 +6139,8 @@ class RawImage extends LeafRenderObjectWidget {
matchTextDirection:
matchTextDirection
,
textDirection:
matchTextDirection
||
alignment
is
!
Alignment
?
Directionality
.
of
(
context
)
:
null
,
invertColors:
invertColors
,
filterQuality:
filterQuality
,
isAntiAlias:
isAntiAlias
,
filterQuality:
filterQuality
,
);
}
...
...
@@ -6158,14 +6158,16 @@ class RawImage extends LeafRenderObjectWidget {
..
height
=
height
..
scale
=
scale
..
color
=
color
..
opacity
=
opacity
..
colorBlendMode
=
colorBlendMode
..
alignment
=
alignment
..
fit
=
fit
..
alignment
=
alignment
..
repeat
=
repeat
..
centerSlice
=
centerSlice
..
matchTextDirection
=
matchTextDirection
..
textDirection
=
matchTextDirection
||
alignment
is
!
Alignment
?
Directionality
.
of
(
context
)
:
null
..
invertColors
=
invertColors
..
isAntiAlias
=
isAntiAlias
..
filterQuality
=
filterQuality
;
}
...
...
packages/flutter/test/widgets/basic_test.dart
View file @
b5932065
...
...
@@ -3,7 +3,7 @@
// found in the LICENSE file.
import
'dart:math'
as
math
;
import
'dart:ui'
;
import
'dart:ui'
as
ui
;
import
'package:flutter/gestures.dart'
;
import
'package:flutter/material.dart'
;
...
...
@@ -11,6 +11,96 @@ import 'package:flutter/rendering.dart';
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
group
(
'RawImage'
,
()
{
testWidgets
(
'properties'
,
(
WidgetTester
tester
)
async
{
final
ui
.
Image
image1
=
(
await
tester
.
runAsync
<
ui
.
Image
>(()
=>
createTestImage
()))!;
await
tester
.
pumpWidget
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
RawImage
(
image:
image1
),
),
);
final
RenderImage
renderObject
=
tester
.
firstRenderObject
<
RenderImage
>(
find
.
byType
(
RawImage
));
// Expect default values
expect
(
renderObject
.
image
!.
isCloneOf
(
image1
),
true
);
expect
(
renderObject
.
debugImageLabel
,
null
);
expect
(
renderObject
.
width
,
null
);
expect
(
renderObject
.
height
,
null
);
expect
(
renderObject
.
scale
,
1.0
);
expect
(
renderObject
.
color
,
null
);
expect
(
renderObject
.
opacity
,
null
);
expect
(
renderObject
.
colorBlendMode
,
null
);
expect
(
renderObject
.
fit
,
null
);
expect
(
renderObject
.
alignment
,
Alignment
.
center
);
expect
(
renderObject
.
repeat
,
ImageRepeat
.
noRepeat
);
expect
(
renderObject
.
centerSlice
,
null
);
expect
(
renderObject
.
matchTextDirection
,
false
);
expect
(
renderObject
.
invertColors
,
false
);
expect
(
renderObject
.
filterQuality
,
FilterQuality
.
low
);
expect
(
renderObject
.
isAntiAlias
,
false
);
final
ui
.
Image
image2
=
(
await
tester
.
runAsync
<
ui
.
Image
>(()
=>
createTestImage
(
width:
2
,
height:
2
)))!;
const
String
debugImageLabel
=
'debugImageLabel'
;
const
double
width
=
1
;
const
double
height
=
1
;
const
double
scale
=
2.0
;
const
Color
color
=
Colors
.
black
;
const
Animation
<
double
>
opacity
=
AlwaysStoppedAnimation
<
double
>(
0.0
);
const
BlendMode
colorBlendMode
=
BlendMode
.
difference
;
const
BoxFit
fit
=
BoxFit
.
contain
;
const
AlignmentGeometry
alignment
=
Alignment
.
topCenter
;
const
ImageRepeat
repeat
=
ImageRepeat
.
repeat
;
const
Rect
centerSlice
=
Rect
.
fromLTWH
(
0
,
0
,
width
,
height
);
const
bool
matchTextDirection
=
true
;
const
bool
invertColors
=
true
;
const
FilterQuality
filterQuality
=
FilterQuality
.
high
;
const
bool
isAntiAlias
=
true
;
await
tester
.
pumpWidget
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
RawImage
(
image:
image2
,
debugImageLabel:
debugImageLabel
,
width:
width
,
height:
height
,
scale:
scale
,
color:
color
,
opacity:
opacity
,
colorBlendMode:
colorBlendMode
,
fit:
fit
,
alignment:
alignment
,
repeat:
repeat
,
centerSlice:
centerSlice
,
matchTextDirection:
matchTextDirection
,
invertColors:
invertColors
,
filterQuality:
filterQuality
,
isAntiAlias:
isAntiAlias
,
),
),
);
expect
(
renderObject
.
image
!.
isCloneOf
(
image2
),
true
);
expect
(
renderObject
.
debugImageLabel
,
debugImageLabel
);
expect
(
renderObject
.
width
,
width
);
expect
(
renderObject
.
height
,
height
);
expect
(
renderObject
.
scale
,
scale
);
expect
(
renderObject
.
color
,
color
);
expect
(
renderObject
.
opacity
,
opacity
);
expect
(
renderObject
.
colorBlendMode
,
colorBlendMode
);
expect
(
renderObject
.
fit
,
fit
);
expect
(
renderObject
.
alignment
,
alignment
);
expect
(
renderObject
.
repeat
,
repeat
);
expect
(
renderObject
.
centerSlice
,
centerSlice
);
expect
(
renderObject
.
matchTextDirection
,
matchTextDirection
);
expect
(
renderObject
.
invertColors
,
invertColors
);
expect
(
renderObject
.
filterQuality
,
filterQuality
);
expect
(
renderObject
.
isAntiAlias
,
isAntiAlias
);
});
});
group
(
'PhysicalShape'
,
()
{
testWidgets
(
'properties'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
...
...
@@ -590,7 +680,7 @@ void main() {
expect
(
mockContext
.
offsets
.
single
,
Offset
.
zero
);
});
testWidgets
(
'ColoredBox -
p
roperties'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'ColoredBox -
debugFillP
roperties'
,
(
WidgetTester
tester
)
async
{
const
ColoredBox
box
=
ColoredBox
(
color:
colorToPaint
);
final
DiagnosticPropertiesBuilder
properties
=
DiagnosticPropertiesBuilder
();
box
.
debugFillProperties
(
properties
);
...
...
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