diff --git a/shell/platform/fuchsia/flutter/gfx_platform_view.cc b/shell/platform/fuchsia/flutter/gfx_platform_view.cc index 0d2ba0272e7cd..ed9eeece151a0 100644 --- a/shell/platform/fuchsia/flutter/gfx_platform_view.cc +++ b/shell/platform/fuchsia/flutter/gfx_platform_view.cc @@ -157,28 +157,6 @@ void GfxPlatformView::OnScenicEvent( break; } break; - case fuchsia::ui::scenic::Event::Tag::kInput: - switch (event.input().Which()) { - case fuchsia::ui::input::InputEvent::Tag::kFocus: - break; // Focus handled elsewhere. - case fuchsia::ui::input::InputEvent::Tag::kPointer: { - // Only received when TouchSource not plugged in. - OnHandlePointerEvent(event.input().pointer()); - break; - } - case fuchsia::ui::input::InputEvent::Tag::kKeyboard: { - // All devices should receive key events via input3.KeyboardListener - // instead. - FML_LOG(WARNING) << "Keyboard event from Scenic: ignored"; - break; - } - case fuchsia::ui::input::InputEvent::Tag::Invalid: { - FML_DCHECK(false) - << "Flutter PlatformView::OnScenicEvent: Got an invalid INPUT " - "event."; - } - } - break; default: { break; } diff --git a/shell/platform/fuchsia/flutter/platform_view_unittest.cc b/shell/platform/fuchsia/flutter/platform_view_unittest.cc index 3d7eb7977f5c0..796f884fa1794 100644 --- a/shell/platform/fuchsia/flutter/platform_view_unittest.cc +++ b/shell/platform/fuchsia/flutter/platform_view_unittest.cc @@ -1496,116 +1496,4 @@ TEST_F(PlatformViewTests, TouchSourceLogicalToPhysicalConversion) { EXPECT_EQ(flutter_events[1].physical_y, 20.f); } -TEST_F(PlatformViewTests, DownPointerNumericNudge) { - constexpr float kSmallDiscrepancy = -0.00003f; - - fuchsia::ui::scenic::SessionListenerPtr session_listener; - MockPlatformViewDelegate delegate; - flutter::TaskRunners task_runners("test_runners", nullptr, nullptr, nullptr, - nullptr); - flutter_runner::GfxPlatformView platform_view = - PlatformViewBuilder(delegate, std::move(task_runners)) - .SetSessionListenerRequest(session_listener.NewRequest()) - .Build(); - RunLoopUntilIdle(); - EXPECT_EQ(delegate.pointer_packets().size(), 0u); - - std::vector events; - events.emplace_back( - fuchsia::ui::scenic::Event::WithGfx( - fuchsia::ui::gfx::Event::WithViewPropertiesChanged( - fuchsia::ui::gfx::ViewPropertiesChangedEvent{ - .view_id = 0, - .properties = - fuchsia::ui::gfx::ViewProperties{ - .bounding_box = - fuchsia::ui::gfx::BoundingBox{ - .min = - fuchsia::ui::gfx::vec3{ - .x = 0.f, - .y = 0.f, - .z = 0.f, - }, - .max = - fuchsia::ui::gfx::vec3{ - .x = 100.f, - .y = 100.f, - .z = 100.f, - }, - }, - }, - }))); - events.emplace_back(fuchsia::ui::scenic::Event::WithGfx( - fuchsia::ui::gfx::Event::WithMetrics(fuchsia::ui::gfx::MetricsEvent{ - .node_id = 0, - .metrics = - fuchsia::ui::gfx::Metrics{ - .scale_x = 1.f, - .scale_y = 1.f, - .scale_z = 1.f, - }, - }))); - events.emplace_back(fuchsia::ui::scenic::Event::WithInput( - fuchsia::ui::input::InputEvent::WithPointer( - fuchsia::ui::input::PointerEvent{ - .event_time = 1111, - .device_id = 2222, - .pointer_id = 3333, - .type = fuchsia::ui::input::PointerEventType::TOUCH, - .phase = fuchsia::ui::input::PointerEventPhase::ADD, - .x = 50.f, - .y = kSmallDiscrepancy, // floating point inaccuracy - .radius_major = 0.f, - .radius_minor = 0.f, - .buttons = 0u, - }))); - events.emplace_back(fuchsia::ui::scenic::Event::WithInput( - fuchsia::ui::input::InputEvent::WithPointer( - fuchsia::ui::input::PointerEvent{ - .event_time = 1111, - .device_id = 2222, - .pointer_id = 3333, - .type = fuchsia::ui::input::PointerEventType::TOUCH, - .phase = fuchsia::ui::input::PointerEventPhase::DOWN, - .x = 50.f, - .y = kSmallDiscrepancy, // floating point inaccuracy - .radius_major = 0.f, - .radius_minor = 0.f, - .buttons = 0u, - }))); - events.emplace_back(fuchsia::ui::scenic::Event::WithInput( - fuchsia::ui::input::InputEvent::WithPointer( - fuchsia::ui::input::PointerEvent{ - .event_time = 1111, - .device_id = 2222, - .pointer_id = 3333, - .type = fuchsia::ui::input::PointerEventType::TOUCH, - .phase = fuchsia::ui::input::PointerEventPhase::MOVE, - .x = 50.f, - .y = kSmallDiscrepancy, // floating point inaccuracy - .radius_major = 0.f, - .radius_minor = 0.f, - .buttons = 0u, - }))); - session_listener->OnScenicEvent(std::move(events)); - RunLoopUntilIdle(); - ASSERT_EQ(delegate.pointer_packets().size(), 3u); - - // Embedder issues pointer data in a bytestream format, PointerDataPacket. - // Use this handy utility to recover data as a C struct, PointerData. - std::vector> packets = - delegate.TakePointerDataPackets(); - std::vector add, down, move; - UnpackPointerPacket(add, std::move(packets[0])); - UnpackPointerPacket(down, std::move(packets[1])); - UnpackPointerPacket(move, std::move(packets[2])); - - EXPECT_EQ(add[0].physical_x, 50.f); - EXPECT_EQ(add[0].physical_y, kSmallDiscrepancy); - EXPECT_EQ(down[0].physical_x, 50.f); - EXPECT_EQ(down[0].physical_y, 0.f); // clamping happened - EXPECT_EQ(move[0].physical_x, 50.f); - EXPECT_EQ(move[0].physical_y, kSmallDiscrepancy); -} - } // namespace flutter_runner::testing