1 /*
2 * Copyright (c) 2020-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
16 #include "events/click_event.h"
17
18 #include <climits>
19 #include <gtest/gtest.h>
20
21 using namespace testing::ext;
22 namespace OHOS {
23 namespace {
24 const Point INIT_POS = { 100, 200 };
25 }
26 class ClickEventTest : public testing::Test {
27 public:
28 static void SetUpTestCase(void);
29 static void TearDownTestCase(void);
30 static ClickEvent* clickEvent_;
31 };
32
33 ClickEvent* ClickEventTest::clickEvent_ = nullptr;
34
SetUpTestCase(void)35 void ClickEventTest::SetUpTestCase(void)
36 {
37 if (clickEvent_ == nullptr) {
38 clickEvent_ = new ClickEvent(INIT_POS);
39 }
40 }
41
TearDownTestCase(void)42 void ClickEventTest::TearDownTestCase(void)
43 {
44 if (clickEvent_ != nullptr) {
45 delete clickEvent_;
46 clickEvent_ = nullptr;
47 }
48 }
49 /**
50 * @tc.name: ClickEventConstructor_001
51 * @tc.desc: Verify Constructor function, equal.
52 * @tc.type: FUNC
53 * @tc.require: SR000DRSH4
54 */
55 HWTEST_F(ClickEventTest, ClickEventConstructor_001, TestSize.Level0)
56 {
57 if (clickEvent_ == nullptr) {
58 EXPECT_EQ(1, 0);
59 return;
60 }
61 EXPECT_EQ(clickEvent_->GetCurrentPos().x, INIT_POS.x);
62 EXPECT_EQ(clickEvent_->GetCurrentPos().y, INIT_POS.y);
63 }
64 } // namespace OHOS
65