• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023-2024 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 <gtest/gtest.h>
16 #include <thread>
17 
18 #include "iservice_registry.h"
19 #include "pasteboard_dialog.h"
20 #include "pasteboard_error.h"
21 
22 namespace OHOS::MiscServices {
23 using namespace testing::ext;
24 class PasteboardDialogNormalBranchTest : public testing::Test {
25 public:
26     static void SetUpTestCase(void);
27     static void TearDownTestCase(void);
28     void SetUp();
29     void TearDown();
30 };
31 
SetUpTestCase(void)32 void PasteboardDialogNormalBranchTest::SetUpTestCase(void) { }
33 
TearDownTestCase(void)34 void PasteboardDialogNormalBranchTest::TearDownTestCase(void) { }
35 
SetUp(void)36 void PasteboardDialogNormalBranchTest::SetUp(void) { }
37 
TearDown(void)38 void PasteboardDialogNormalBranchTest::TearDown(void) { }
39 
40 /**
41  * @tc.name: ShowToastNormalTest
42  * @tc.desc: Show Toast test normal branch.
43  * @tc.type: FUNC
44  */
45 HWTEST_F(PasteboardDialogNormalBranchTest, ShowToastNormalTest, TestSize.Level0)
46 {
47     PasteBoardDialog::ToastMessageInfo message;
48     message.appName = "myAppName";
49     int32_t ret = PasteBoardDialog::GetInstance().ShowToast(message);
50     EXPECT_FALSE(ret == static_cast<int32_t>(PasteboardError::TASK_PROCESSING));
51 }
52 
53 /**
54  * @tc.name: CancelToastNormalTest
55  * @tc.desc: Cancel Toast test.
56  * @tc.type: FUNC
57  */
58 HWTEST_F(PasteboardDialogNormalBranchTest, CancelToastNormalTest, TestSize.Level0)
59 {
60     PasteBoardDialog::GetInstance().CancelToast();
61     EXPECT_TRUE(true);
62 }
63 } // namespace OHOS::MiscServices