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
0581c05c
Unverified
Commit
0581c05c
authored
May 11, 2021
by
Viren Khatri
Committed by
GitHub
May 11, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
📝
Added tests for toString to increase coverage (#82235)
parent
d10afc41
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
97 additions
and
4 deletions
+97
-4
platform_views.dart
packages/flutter/lib/src/services/platform_views.dart
+4
-3
system_chrome.dart
packages/flutter/lib/src/services/system_chrome.dart
+1
-1
asset_bundle_test.dart
packages/flutter/test/services/asset_bundle_test.dart
+7
-0
message_codecs_test.dart
packages/flutter/test/services/message_codecs_test.dart
+10
-0
platform_views_test.dart
packages/flutter/test/services/platform_views_test.dart
+62
-0
system_chrome_test.dart
packages/flutter/test/services/system_chrome_test.dart
+13
-0
No files found.
packages/flutter/lib/src/services/platform_views.dart
View file @
0581c05c
...
...
@@ -6,6 +6,7 @@
import
'dart:typed_data'
;
import
'dart:ui'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/gestures.dart'
;
import
'message_codec.dart'
;
...
...
@@ -258,7 +259,7 @@ class AndroidPointerProperties {
@override
String
toString
()
{
return
'
AndroidPointerProperties
(id:
$id
, toolType:
$toolType
)'
;
return
'
${objectRuntimeType(this, 'AndroidPointerProperties')}
(id:
$id
, toolType:
$toolType
)'
;
}
}
...
...
@@ -342,7 +343,7 @@ class AndroidPointerCoords {
@override
String
toString
()
{
return
'
AndroidPointerCoords
(orientation:
$orientation
, pressure:
$pressure
, size:
$size
, toolMajor:
$toolMajor
, toolMinor:
$toolMinor
, touchMajor:
$touchMajor
, touchMinor:
$touchMinor
, x:
$x
, y:
$y
)'
;
return
'
${objectRuntimeType(this, 'AndroidPointerCoords')}
(orientation:
$orientation
, pressure:
$pressure
, size:
$size
, toolMajor:
$toolMajor
, toolMinor:
$toolMinor
, touchMajor:
$touchMajor
, touchMinor:
$touchMinor
, x:
$x
, y:
$y
)'
;
}
}
...
...
@@ -482,7 +483,7 @@ class AndroidMotionEvent {
@override
String
toString
()
{
return
'AndroidPointerEvent(downTime:
$downTime
, eventTime:
$eventTime
, action:
$action
, pointerCount:
$pointerCount
, pointerProperties:
$pointerProperties
, pointerCoords:
$pointerCoords
, metaState:
$metaState
, buttonState:
$buttonState
, xPrecision:
$xPrecision
, yPrecision:
$yPrecision
, deviceId:
$deviceId
, edgeFlags:
$edgeFlags
, source:
$source
, flags:
$flags
)'
;
return
'AndroidPointerEvent(downTime:
$downTime
, eventTime:
$eventTime
, action:
$action
, pointerCount:
$pointerCount
, pointerProperties:
$pointerProperties
, pointerCoords:
$pointerCoords
, metaState:
$metaState
, buttonState:
$buttonState
, xPrecision:
$xPrecision
, yPrecision:
$yPrecision
, deviceId:
$deviceId
, edgeFlags:
$edgeFlags
, source:
$source
, flags:
$flags
, motionEventId:
$motionEventId
)'
;
}
}
...
...
packages/flutter/lib/src/services/system_chrome.dart
View file @
0581c05c
...
...
@@ -163,7 +163,7 @@ class SystemUiOverlayStyle {
}
@override
String
toString
()
=>
_toMap
().
toString
()
;
String
toString
()
=>
'
${objectRuntimeType(this, 'SystemUiOverlayStyle')}
(
${_toMap()}
)'
;
/// Creates a copy of this theme with the given fields replaced with new values.
SystemUiOverlayStyle
copyWith
({
...
...
packages/flutter/test/services/asset_bundle_test.dart
View file @
0581c05c
...
...
@@ -75,4 +75,11 @@ void main() {
' HTTP status code: 404
\n
'
,
);
},
skip:
isBrowser
);
// https://github.com/flutter/flutter/issues/39998
test
(
'toString works as intended'
,
()
{
final
Uri
uri
=
Uri
.
http
(
'example.org'
,
'/path'
);
final
NetworkAssetBundle
bundle
=
NetworkAssetBundle
(
uri
);
expect
(
bundle
.
toString
(),
'NetworkAssetBundle#
${shortHash(bundle)}
(
$uri
)'
);
},
skip:
isBrowser
);
// https://github.com/flutter/flutter/issues/39998
}
packages/flutter/test/services/message_codecs_test.dart
View file @
0581c05c
...
...
@@ -255,4 +255,14 @@ void main() {
);
});
});
test
(
'toString works as intended'
,
()
async
{
const
MethodCall
methodCall
=
MethodCall
(
'sample method'
);
final
PlatformException
platformException
=
PlatformException
(
code:
'100'
);
final
MissingPluginException
missingPluginException
=
MissingPluginException
();
expect
(
methodCall
.
toString
(),
'MethodCall(sample method, null)'
);
expect
(
platformException
.
toString
(),
'PlatformException(100, null, null, null)'
);
expect
(
missingPluginException
.
toString
(),
'MissingPluginException(null)'
);
});
}
packages/flutter/test/services/platform_views_test.dart
View file @
0581c05c
...
...
@@ -300,4 +300,66 @@ void main() {
);
});
});
test
(
'toString works as intended'
,
()
async
{
const
AndroidPointerProperties
androidPointerProperties
=
AndroidPointerProperties
(
id:
0
,
toolType:
0
);
expect
(
androidPointerProperties
.
toString
(),
'AndroidPointerProperties(id: 0, toolType: 0)'
);
const
double
zero
=
0.0
;
const
AndroidPointerCoords
androidPointerCoords
=
AndroidPointerCoords
(
orientation:
zero
,
pressure:
zero
,
size:
zero
,
toolMajor:
zero
,
toolMinor:
zero
,
touchMajor:
zero
,
touchMinor:
zero
,
x:
zero
,
y:
zero
);
expect
(
androidPointerCoords
.
toString
(),
'AndroidPointerCoords(orientation:
$zero
, '
'pressure:
$zero
, '
'size:
$zero
, '
'toolMajor:
$zero
, '
'toolMinor:
$zero
, '
'touchMajor:
$zero
, '
'touchMinor:
$zero
, '
'x:
$zero
, '
'y:
$zero
)'
,
);
final
AndroidMotionEvent
androidMotionEvent
=
AndroidMotionEvent
(
downTime:
0
,
eventTime:
0
,
action:
0
,
pointerCount:
0
,
pointerProperties:
<
AndroidPointerProperties
>[],
pointerCoords:
<
AndroidPointerCoords
>[],
metaState:
0
,
buttonState:
0
,
xPrecision:
zero
,
yPrecision:
zero
,
deviceId:
0
,
edgeFlags:
0
,
source
:
0
,
flags:
0
,
motionEventId:
0
);
expect
(
androidMotionEvent
.
toString
(),
'AndroidPointerEvent(downTime: 0, '
'eventTime: 0, '
'action: 0, '
'pointerCount: 0, '
'pointerProperties: [], '
'pointerCoords: [], '
'metaState: 0, '
'buttonState: 0, '
'xPrecision:
$zero
, '
'yPrecision:
$zero
, '
'deviceId: 0, '
'edgeFlags: 0, '
'source: 0, '
'flags: 0, '
'motionEventId: 0)'
,
);
});
}
packages/flutter/test/services/system_chrome_test.dart
View file @
0581c05c
...
...
@@ -86,4 +86,17 @@ void main() {
arguments:
<
String
>[
'SystemUiOverlay.top'
],
));
});
test
(
'toString works as intended'
,
()
async
{
const
SystemUiOverlayStyle
systemUiOverlayStyle
=
SystemUiOverlayStyle
();
expect
(
systemUiOverlayStyle
.
toString
(),
'SystemUiOverlayStyle({'
'systemNavigationBarColor: null, '
'systemNavigationBarDividerColor: null, '
'statusBarColor: null, '
'statusBarBrightness: null, '
'statusBarIconBrightness: null, '
'systemNavigationBarIconBrightness: null})'
,
);
});
}
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