Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
test_keyboard_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 <windows.h>
6
7#include "flutter/shell/platform/windows/testing/test_keyboard.h"
8#include "gtest/gtest.h"
9
10namespace flutter {
11namespace testing {
12
13TEST(TestKeyboard, CloneString) {
14 const char* str1 = "123";
15 char* cloned_str1 = clone_string(str1);
16 EXPECT_STREQ(str1, cloned_str1);
17 EXPECT_NE(str1, cloned_str1);
18 delete[] cloned_str1;
19
20 EXPECT_EQ(clone_string(nullptr), nullptr);
21};
22
23TEST(TestKeyboard, CreateKeyEventLparam) {
24 EXPECT_EQ(CreateKeyEventLparam(0x1, true, true), 0xC1010001);
25
26 EXPECT_EQ(CreateKeyEventLparam(0x05, false, false, 0, 1, 0), 0x20050000);
27};
28
29} // namespace testing
30} // namespace flutter
#define TEST(S, s, D, expected)
LPARAM CreateKeyEventLparam(USHORT scancode, bool extended, bool was_down, USHORT repeat_count, bool context_code, bool transition_state)
char * clone_string(const char *string)