1 /* 2 * Copyright (c) 2023 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 <thread> 16 17 #include <gtest/gtest.h> 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)32void PasteboardDialogNormalBranchTest::SetUpTestCase(void) 33 { 34 } 35 TearDownTestCase(void)36void PasteboardDialogNormalBranchTest::TearDownTestCase(void) 37 { 38 } 39 SetUp(void)40void PasteboardDialogNormalBranchTest::SetUp(void) 41 { 42 } 43 TearDown(void)44void PasteboardDialogNormalBranchTest::TearDown(void) 45 { 46 } 47 48 /** 49 * @tc.name: ShowToastNormalTest 50 * @tc.desc: Show Toast test normal branch. 51 * @tc.type: FUNC 52 */ 53 HWTEST_F(PasteboardDialogNormalBranchTest, ShowToastNormalTest, TestSize.Level0) 54 { 55 PasteBoardDialog::ToastMessageInfo message; 56 message.appName = "myAppName"; 57 int32_t ret = PasteBoardDialog::GetInstance().ShowToast(message); 58 EXPECT_TRUE(ret == static_cast<int32_t>(PasteboardError::TASK_PROCESSING)); 59 } 60 61 /** 62 * @tc.name: CancelToastNormalTest 63 * @tc.desc: Cancel Toast test. 64 * @tc.type: FUNC 65 */ 66 HWTEST_F(PasteboardDialogNormalBranchTest, CancelToastNormalTest, TestSize.Level0) 67 { 68 PasteBoardDialog::GetInstance().CancelToast(); 69 EXPECT_TRUE(true); 70 } 71 }