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/release_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 ReleaseEventTest : public testing::Test {
27 public:
28 static void SetUpTestCase(void);
29 static void TearDownTestCase(void);
30 static ReleaseEvent* releaseEvent_;
31 };
32
33 ReleaseEvent* ReleaseEventTest::releaseEvent_ = nullptr;
34
SetUpTestCase(void)35 void ReleaseEventTest::SetUpTestCase(void)
36 {
37 if (releaseEvent_ == nullptr) {
38 releaseEvent_ = new ReleaseEvent(INIT_POS);
39 }
40 }
41
TearDownTestCase(void)42 void ReleaseEventTest::TearDownTestCase(void)
43 {
44 if (releaseEvent_ != nullptr) {
45 delete releaseEvent_;
46 releaseEvent_ = nullptr;
47 }
48 }
49
50 /**
51 * @tc.name: ReleaseEventConstructor_001
52 * @tc.desc: Verify GetCurrentPos function, equal.
53 * @tc.type: FUNC
54 * @tc.require: SR000DRSH4
55 */
56 HWTEST_F(ReleaseEventTest, ReleaseEventConstructor_001, TestSize.Level0)
57 {
58 EXPECT_EQ(releaseEvent_->GetCurrentPos().x, INIT_POS.x);
59 EXPECT_EQ(releaseEvent_->GetCurrentPos().y, INIT_POS.y);
60 }
61 } // namespace OHOS
62