Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | List of all members
flutter_runner::testing::MouseEventBuilder Class Reference

#include <pointer_event_utility.h>

Public Member Functions

MouseEventBuilderAddTime (zx_time_t time)
 
MouseEventBuilderAddSample (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)
 
MouseEventBuilderAddViewParameters (std::array< std::array< float, 2 >, 2 > view, std::array< std::array< float, 2 >, 2 > viewport, std::array< float, 9 > transform)
 
MouseEventBuilderAddMouseDeviceInfo (uint32_t id, std::vector< uint8_t > buttons)
 
fuchsia::ui::pointer::MouseEvent Build ()
 
std::vector< fuchsia::ui::pointer::MouseEvent > BuildAsVector ()
 

Static Public Member Functions

static MouseEventBuilder New ()
 

Detailed Description

Definition at line 44 of file pointer_event_utility.h.

Member Function Documentation

◆ AddMouseDeviceInfo()

MouseEventBuilder & flutter_runner::testing::MouseEventBuilder::AddMouseDeviceInfo ( uint32_t  id,
std::vector< uint8_t >  buttons 
)

Definition at line 143 of file pointer_event_utility.cc.

145 {
146 device_info_ = std::make_optional<fup_MouseDeviceInfo>();
147 device_info_->set_id(id);
148 device_info_->set_buttons(buttons);
149 return *this;
150}

◆ AddSample()

MouseEventBuilder & flutter_runner::testing::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 
)

Definition at line 105 of file pointer_event_utility.cc.

111 {
112 sample_ = std::make_optional<fup_MousePointerSample>();
113 sample_->set_device_id(id);
114 if (!pressed_buttons.empty()) {
115 sample_->set_pressed_buttons(pressed_buttons);
116 }
117 sample_->set_position_in_viewport(position);
118 if (scroll[0] != 0) {
119 sample_->set_scroll_h(scroll[0]);
120 }
121 if (scroll[1] != 0) {
122 sample_->set_scroll_v(scroll[1]);
123 }
124 if (scroll_in_physical_pixel[0] != 0) {
125 sample_->set_scroll_h_physical_pixel(scroll_in_physical_pixel[0]);
126 }
127 if (scroll_in_physical_pixel[1] != 0) {
128 sample_->set_scroll_v_physical_pixel(scroll_in_physical_pixel[1]);
129 }
130 sample_->set_is_precision_scroll(is_precision_scroll);
131 return *this;
132}

◆ AddTime()

MouseEventBuilder & flutter_runner::testing::MouseEventBuilder::AddTime ( zx_time_t  time)

Definition at line 100 of file pointer_event_utility.cc.

100 {
101 time_ = time;
102 return *this;
103}
static double time(int loops, Benchmark *bench, Target *target)
Definition: nanobench.cpp:394

◆ AddViewParameters()

MouseEventBuilder & flutter_runner::testing::MouseEventBuilder::AddViewParameters ( std::array< std::array< float, 2 >, 2 >  view,
std::array< std::array< float, 2 >, 2 >  viewport,
std::array< float, 9 >  transform 
)

Definition at line 134 of file pointer_event_utility.cc.

137 {
138 params_ = CreateViewParameters(std::move(view), std::move(viewport),
139 std::move(transform));
140 return *this;
141}
static SkColor4f transform(SkColor4f c, SkColorSpace *src, SkColorSpace *dst)
Definition: p3.cpp:47

◆ Build()

fup_MouseEvent flutter_runner::testing::MouseEventBuilder::Build ( )

Definition at line 152 of file pointer_event_utility.cc.

152 {
154 if (time_) {
155 event.set_timestamp(time_.value());
156 }
157 if (params_) {
158 event.set_view_parameters(std::move(params_.value()));
159 }
160 if (sample_) {
161 event.set_pointer_sample(std::move(sample_.value()));
162 }
163 if (device_info_) {
164 event.set_device_info(std::move(device_info_.value()));
165 }
166 event.set_trace_flow_id(123);
167 return event;
168}
FlKeyEvent * event
fuchsia::ui::pointer::MouseEvent fup_MouseEvent

◆ BuildAsVector()

std::vector< fup_MouseEvent > flutter_runner::testing::MouseEventBuilder::BuildAsVector ( )

Definition at line 170 of file pointer_event_utility.cc.

170 {
171 std::vector<fup_MouseEvent> events;
172 events.emplace_back(Build());
173 return events;
174}
fuchsia::ui::pointer::MouseEvent Build()

◆ New()

MouseEventBuilder flutter_runner::testing::MouseEventBuilder::New ( )
static

Definition at line 96 of file pointer_event_utility.cc.

96 {
97 return MouseEventBuilder();
98}

The documentation for this class was generated from the following files: