• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #include "input_method_utils.h"
16 
17 #include <gtest/gtest.h>
18 #include <sys/time.h>
19 #include <unistd.h>
20 
21 #include <cstdint>
22 #include <string>
23 
24 #include "global.h"
25 
26 using namespace testing::ext;
27 namespace OHOS {
28 namespace MiscServices {
29 class InputMethodUtilsTest : public testing::Test {
30 public:
31     static void SetUpTestCase(void);
32     static void TearDownTestCase(void);
33     void SetUp();
34     void TearDown();
35 };
36 
SetUpTestCase(void)37 void InputMethodUtilsTest::SetUpTestCase(void)
38 {
39     IMSA_HILOGI("InputMethodUtilsTest::SetUpTestCase");
40 }
41 
TearDownTestCase(void)42 void InputMethodUtilsTest::TearDownTestCase(void)
43 {
44     IMSA_HILOGI("InputMethodUtilsTest::TearDownTestCase");
45 }
46 
SetUp(void)47 void InputMethodUtilsTest::SetUp(void)
48 {
49     IMSA_HILOGI("InputMethodUtilsTest::SetUp");
50 }
51 
TearDown(void)52 void InputMethodUtilsTest::TearDown(void)
53 {
54     IMSA_HILOGI("InputMethodUtilsTest::TearDown");
55 }
56 
57 /**
58 * @tc.name: inputMethodUtils_keyboardStatus_001
59 * @tc.desc: Checkout KeyboardStatus.
60 * @tc.type: FUNC
61 */
62 HWTEST_F(InputMethodUtilsTest, inputMethodUtils_keyboardStatus_001, TestSize.Level0)
63 {
64     KeyboardInfo info;
65     info.SetKeyboardStatus(int32_t(KeyboardStatus::SHOW));
66     KeyboardStatus status = info.GetKeyboardStatus();
67     EXPECT_EQ(status, KeyboardStatus::SHOW);
68 }
69 
70 /**
71 * @tc.name: inputMethodUtils_functionKey_001
72 * @tc.desc: Checkout FunctionKey.
73 * @tc.type: FUNC
74 */
75 HWTEST_F(InputMethodUtilsTest, inputMethodUtils_functionKey_001, TestSize.Level0)
76 {
77     KeyboardInfo info;
78     info.SetFunctionKey(int32_t(FunctionKey::CONFIRM));
79     FunctionKey key = info.GetFunctionKey();
80     EXPECT_EQ(key, FunctionKey::CONFIRM);
81 }
82 } // namespace MiscServices
83 } // namespace OHOS