Flutter Engine
The Flutter Engine
pointer_event_utility.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_SHELL_PLATFORM_FUCHSIA_FLUTTER_TESTS_POINTER_EVENT_UTILITY_H_
6#define FLUTTER_SHELL_PLATFORM_FUCHSIA_FLUTTER_TESTS_POINTER_EVENT_UTILITY_H_
7
8#include <fuchsia/ui/pointer/cpp/fidl.h>
9#include <zircon/types.h>
10
11#include <array>
12#include <optional>
13#include <vector>
14
16
17// A helper class for crafting a fuchsia.ui.pointer.TouchEvent table.
19 public:
20 static TouchEventBuilder New();
21
22 TouchEventBuilder& AddTime(zx_time_t time);
23 TouchEventBuilder& AddSample(fuchsia::ui::pointer::TouchInteractionId id,
24 fuchsia::ui::pointer::EventPhase phase,
25 std::array<float, 2> position);
27 std::array<std::array<float, 2>, 2> view,
28 std::array<std::array<float, 2>, 2> viewport,
29 std::array<float, 9> transform);
31 fuchsia::ui::pointer::TouchInteractionResult result);
32
33 fuchsia::ui::pointer::TouchEvent Build();
34 std::vector<fuchsia::ui::pointer::TouchEvent> BuildAsVector();
35
36 private:
37 std::optional<zx_time_t> time_;
38 std::optional<fuchsia::ui::pointer::ViewParameters> params_;
39 std::optional<fuchsia::ui::pointer::TouchPointerSample> sample_;
40 std::optional<fuchsia::ui::pointer::TouchInteractionResult> result_;
41};
42
43// A helper class for crafting a fuchsia.ui.pointer.MouseEventBuilder table.
45 public:
46 static MouseEventBuilder New();
47
48 MouseEventBuilder& AddTime(zx_time_t time);
49 MouseEventBuilder& AddSample(uint32_t id,
50 std::array<float, 2> position,
51 std::vector<uint8_t> pressed_buttons,
52 std::array<int64_t, 2> scroll,
53 std::array<int64_t, 2> scroll_in_physical_pixel,
54 bool is_precision_scroll);
56 std::array<std::array<float, 2>, 2> view,
57 std::array<std::array<float, 2>, 2> viewport,
58 std::array<float, 9> transform);
60 std::vector<uint8_t> buttons);
61 fuchsia::ui::pointer::MouseEvent Build();
62 std::vector<fuchsia::ui::pointer::MouseEvent> BuildAsVector();
63
64 private:
65 std::optional<zx_time_t> time_;
66 std::optional<fuchsia::ui::pointer::MousePointerSample> sample_;
67 std::optional<fuchsia::ui::pointer::ViewParameters> params_;
68 std::optional<fuchsia::ui::pointer::MouseDeviceInfo> device_info_;
69};
70
71} // namespace flutter_runner::testing
72
73#endif // FLUTTER_SHELL_PLATFORM_FUCHSIA_FLUTTER_TESTS_POINTER_EVENT_UTILITY_H_
fuchsia::ui::pointer::MouseEvent Build()
MouseEventBuilder & AddSample(uint32_t id, std::array< float, 2 > position, std::vector< uint8_t > pressed_buttons, std::array< int64_t, 2 > scroll, std::array< int64_t, 2 > scroll_in_physical_pixel, bool is_precision_scroll)
std::vector< fuchsia::ui::pointer::MouseEvent > BuildAsVector()
MouseEventBuilder & AddViewParameters(std::array< std::array< float, 2 >, 2 > view, std::array< std::array< float, 2 >, 2 > viewport, std::array< float, 9 > transform)
MouseEventBuilder & AddTime(zx_time_t time)
MouseEventBuilder & AddMouseDeviceInfo(uint32_t id, std::vector< uint8_t > buttons)
std::vector< fuchsia::ui::pointer::TouchEvent > BuildAsVector()
fuchsia::ui::pointer::TouchEvent Build()
TouchEventBuilder & AddViewParameters(std::array< std::array< float, 2 >, 2 > view, std::array< std::array< float, 2 >, 2 > viewport, std::array< float, 9 > transform)
TouchEventBuilder & AddSample(fuchsia::ui::pointer::TouchInteractionId id, fuchsia::ui::pointer::EventPhase phase, std::array< float, 2 > position)
TouchEventBuilder & AddTime(zx_time_t time)
TouchEventBuilder & AddResult(fuchsia::ui::pointer::TouchInteractionResult result)
GAsyncResult * result
static double time(int loops, Benchmark *bench, Target *target)
Definition: nanobench.cpp:394
static SkColor4f transform(SkColor4f c, SkColorSpace *src, SkColorSpace *dst)
Definition: p3.cpp:47