chromium/ui/events/blink/web_input_event_unittest.cc

// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "ui/events/blink/web_input_event.h"

#include <cstddef>
#include <cstdint>

#include "base/test/scoped_feature_list.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/ui_base_features.h"
#include "ui/events/base_event_utils.h"
#include "ui/events/blink/blink_event_util.h"
#include "ui/events/event.h"
#include "ui/events/event_utils.h"
#include "ui/events/keycodes/dom/dom_code.h"
#include "ui/events/keycodes/dom/dom_key.h"
#include "ui/events/keycodes/dom/keycode_converter.h"
#include "ui/events/test/keyboard_layout.h"

namespace ui {

// Checks that MakeWebKeyboardEvent makes a DOM3 spec compliant key event.
// crbug.com/127142
TEST(WebInputEventTest, TestMakeWebKeyboardEvent) {}

TEST(WebInputEventTest, TestMakeWebKeyboardEventWindowsKeyCode) {}

// Checks that MakeWebKeyboardEvent fills a correct keypad modifier.
TEST(WebInputEventTest, TestMakeWebKeyboardEventKeyPadKeyCode) {}

TEST(WebInputEventTest, TestMakeWebMouseEvent) {}

TEST(WebInputEventTest, TestMakeWebMouseWheelEvent) {}

#if !BUILDFLAG(IS_MAC)
TEST(WebInputEventTest, TestPercentMouseWheelScroll) {}
#endif

TEST(WebInputEventTest, KeyEvent) {}

TEST(WebInputEventTest, WheelEvent) {}

TEST(WebInputEventTest, MousePointerEvent) {}

#if BUILDFLAG(IS_WIN)
TEST(WebInputEventTest, MouseLeaveScreenCoordinate) {
  CHROME_MSG msg_event = {nullptr, WM_MOUSELEAVE, 0, MAKELPARAM(300, 200)};
  ::SetCursorPos(250, 350);
  ui::MouseEvent ui_event(msg_event);

  blink::WebMouseEvent web_event = MakeWebMouseEvent(ui_event);
  ASSERT_EQ(blink::WebInputEvent::Type::kMouseLeave, web_event.GetType());

  // WM_MOUSELEAVE events take coordinates from cursor position instead of
  // LPARAM.
  ASSERT_EQ(250, web_event.PositionInWidget().x());
  ASSERT_EQ(350, web_event.PositionInWidget().y());
  ASSERT_EQ(250, web_event.PositionInScreen().x());
  ASSERT_EQ(350, web_event.PositionInScreen().y());
}
#endif

TEST(WebInputEventTest, MouseMoveUnadjustedMovement) {}

}  // namespace ui