-
Notifications
You must be signed in to change notification settings - Fork 5.9k
/
scenario.dart
46 lines (38 loc) · 1.3 KB
/
scenario.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// 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:typed_data';
import 'dart:ui';
/// A scenario to run for testing.
abstract class Scenario {
/// Creates a new scenario using a specific Window instance.
const Scenario(this.window);
/// The window used by this scenario. May be mocked.
final Window window;
/// Called by the program when a frame is ready to be drawn.
///
/// See [Window.onBeginFrame] for more details.
void onBeginFrame(Duration duration);
/// Called by the program when the microtasks from [onBeginFrame] have been
/// flushed.
///
/// See [Window.onDrawFrame] for more details.
void onDrawFrame() {}
/// Called by the program when the window metrics have changed.
///
/// See [Window.onMetricsChanged].
void onMetricsChanged() {}
/// Called by the program when a pointer event is received.
///
/// See [Window.onPointerDataPacket].
void onPointerDataPacket(PointerDataPacket packet) {}
/// Called by the program when an engine side platform channel message is
/// received.
///
/// See [Window.onPlatformMessage].
void onPlatformMessage(
String name,
ByteData data,
PlatformMessageResponseCallback callback,
) {}
}