Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
pointer_data_packet_unittests.cc
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#include "flutter/lib/ui/window/pointer_data.h"
6
7#include <cstring>
8
9#include "gtest/gtest.h"
10#include "pointer_data_packet.h"
11
12namespace flutter {
13namespace testing {
14
17 int64_t device,
18 double dx,
19 double dy,
20 int64_t buttons) {
21 data.time_stamp = 0;
22 data.change = change;
25 data.device = device;
26 data.pointer_identifier = 0;
27 data.physical_x = dx;
28 data.physical_y = dy;
29 data.physical_delta_x = 0.0;
30 data.physical_delta_y = 0.0;
31 data.buttons = buttons;
32 data.obscured = 0;
33 data.synthesized = 0;
34 data.pressure = 0.0;
35 data.pressure_min = 0.0;
36 data.pressure_max = 0.0;
37 data.distance = 0.0;
38 data.distance_max = 0.0;
39 data.size = 0.0;
40 data.radius_major = 0.0;
41 data.radius_minor = 0.0;
42 data.radius_min = 0.0;
43 data.radius_max = 0.0;
44 data.orientation = 0.0;
45 data.tilt = 0.0;
46 data.platformData = 0;
47 data.scroll_delta_x = 0.0;
48 data.scroll_delta_y = 0.0;
49}
50
51TEST(PointerDataPacketTest, CanGetPointerData) {
52 auto packet = std::make_unique<PointerDataPacket>(1);
55 4);
56 packet->SetPointerData(0, data);
57
58 PointerData data_recovered = packet->GetPointerData(0);
59 ASSERT_EQ(data_recovered.physical_x, 2.0);
60 ASSERT_EQ(data_recovered.physical_y, 3.0);
61}
62
63TEST(PointerDataPacketTest, CanGetLength) {
64 auto packet = std::make_unique<PointerDataPacket>(6);
65 ASSERT_EQ(packet->GetLength(), (size_t)6);
66}
67
68} // namespace testing
69} // namespace flutter
#define TEST(S, s, D, expected)
VkDevice device
Definition main.cc:53
void CreateSimpleSimulatedPointerData(PointerData &data, PointerData::Change change, int64_t device, double dx, double dy, int64_t buttons)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
Definition switches.h:41