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
f0dec6e3
Commit
f0dec6e3
authored
Jul 24, 2017
by
Ian Hickson
Committed by
GitHub
Jul 24, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a debug feature to the gestures library to dump hit test results (#11346)
parent
94ed7dce
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
0 deletions
+42
-0
gestures.dart
packages/flutter/lib/gestures.dart
+1
-0
binding.dart
packages/flutter/lib/src/gestures/binding.dart
+6
-0
debug.dart
packages/flutter/lib/src/gestures/debug.dart
+32
-0
binding.dart
packages/flutter_test/lib/src/binding.dart
+3
-0
No files found.
packages/flutter/lib/gestures.dart
View file @
f0dec6e3
...
@@ -11,6 +11,7 @@ export 'src/gestures/arena.dart';
...
@@ -11,6 +11,7 @@ export 'src/gestures/arena.dart';
export
'src/gestures/binding.dart'
;
export
'src/gestures/binding.dart'
;
export
'src/gestures/constants.dart'
;
export
'src/gestures/constants.dart'
;
export
'src/gestures/converter.dart'
;
export
'src/gestures/converter.dart'
;
export
'src/gestures/debug.dart'
;
export
'src/gestures/drag.dart'
;
export
'src/gestures/drag.dart'
;
export
'src/gestures/drag_details.dart'
;
export
'src/gestures/drag_details.dart'
;
export
'src/gestures/events.dart'
;
export
'src/gestures/events.dart'
;
...
...
packages/flutter/lib/src/gestures/binding.dart
View file @
f0dec6e3
...
@@ -10,6 +10,7 @@ import 'package:flutter/foundation.dart';
...
@@ -10,6 +10,7 @@ import 'package:flutter/foundation.dart';
import
'arena.dart'
;
import
'arena.dart'
;
import
'converter.dart'
;
import
'converter.dart'
;
import
'debug.dart'
;
import
'events.dart'
;
import
'events.dart'
;
import
'hit_test.dart'
;
import
'hit_test.dart'
;
import
'pointer_router.dart'
;
import
'pointer_router.dart'
;
...
@@ -75,6 +76,11 @@ abstract class GestureBinding extends BindingBase with HitTestable, HitTestDispa
...
@@ -75,6 +76,11 @@ abstract class GestureBinding extends BindingBase with HitTestable, HitTestDispa
result
=
new
HitTestResult
();
result
=
new
HitTestResult
();
hitTest
(
result
,
event
.
position
);
hitTest
(
result
,
event
.
position
);
_hitTests
[
event
.
pointer
]
=
result
;
_hitTests
[
event
.
pointer
]
=
result
;
assert
(()
{
if
(
debugPrintHitTestResults
)
debugPrint
(
'
$event
:
$result
'
);
return
true
;
});
}
else
if
(
event
is
PointerUpEvent
||
event
is
PointerCancelEvent
)
{
}
else
if
(
event
is
PointerUpEvent
||
event
is
PointerCancelEvent
)
{
result
=
_hitTests
.
remove
(
event
.
pointer
);
result
=
_hitTests
.
remove
(
event
.
pointer
);
}
else
if
(
event
.
down
)
{
}
else
if
(
event
.
down
)
{
...
...
packages/flutter/lib/src/gestures/debug.dart
0 → 100644
View file @
f0dec6e3
// Copyright 2017 The Chromium 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
'package:flutter/foundation.dart'
;
// Any changes to this file should be reflected in the debugAssertAllGesturesVarsUnset()
// function below.
/// Whether to print the results of each hit test to the console.
///
/// When this is set, in debug mode, any time a hit test is triggered by the
/// [GestureBinding] the results are dumped to the console.
///
/// This has no effect in release builds.
bool
debugPrintHitTestResults
=
false
;
/// Returns true if none of the gestures library debug variables have been changed.
///
/// This function is used by the test framework to ensure that debug variables
/// haven't been inadvertently changed.
///
/// See [https://docs.flutter.io/flutter/gestures/gestures-library.html] for
/// a complete list.
bool
debugAssertAllGesturesVarsUnset
(
String
reason
)
{
assert
(()
{
if
(
debugPrintHitTestResults
)
throw
new
FlutterError
(
reason
);
return
true
;
});
return
true
;
}
packages/flutter_test/lib/src/binding.dart
View file @
f0dec6e3
...
@@ -474,6 +474,9 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
...
@@ -474,6 +474,9 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
'The value of a foundation debug variable was changed by the test.'
,
'The value of a foundation debug variable was changed by the test.'
,
debugPrintOverride:
debugPrintOverride
,
debugPrintOverride:
debugPrintOverride
,
));
));
assert
(
debugAssertAllGesturesVarsUnset
(
'The value of a gestures debug variable was changed by the test.'
,
));
assert
(
debugAssertAllRenderVarsUnset
(
assert
(
debugAssertAllRenderVarsUnset
(
'The value of a rendering debug variable was changed by the test.'
,
'The value of a rendering debug variable was changed by the test.'
,
debugCheckIntrinsicSizesOverride:
checkIntrinsicSizes
,
debugCheckIntrinsicSizesOverride:
checkIntrinsicSizes
,
...
...
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