123b3eb3cSopenharmony_ci/*
223b3eb3cSopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd.
323b3eb3cSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
423b3eb3cSopenharmony_ci * you may not use this file except in compliance with the License.
523b3eb3cSopenharmony_ci * You may obtain a copy of the License at
623b3eb3cSopenharmony_ci *
723b3eb3cSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
823b3eb3cSopenharmony_ci *
923b3eb3cSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1023b3eb3cSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1123b3eb3cSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1223b3eb3cSopenharmony_ci * See the License for the specific language governing permissions and
1323b3eb3cSopenharmony_ci * limitations under the License.
1423b3eb3cSopenharmony_ci */
1523b3eb3cSopenharmony_ci
1623b3eb3cSopenharmony_ci#include "animate_impl.h"
1723b3eb3cSopenharmony_ci#include "core/interfaces/arkoala/arkoala_api.h"
1823b3eb3cSopenharmony_ci#include "dialog_model.h"
1923b3eb3cSopenharmony_ci#include "error_code.h"
2023b3eb3cSopenharmony_ci#include "event_converter.h"
2123b3eb3cSopenharmony_ci#include "gtest/gtest.h"
2223b3eb3cSopenharmony_ci#include "native_animate.h"
2323b3eb3cSopenharmony_ci#include "native_interface.h"
2423b3eb3cSopenharmony_ci#include "native_node.h"
2523b3eb3cSopenharmony_ci#include "node_extened.h"
2623b3eb3cSopenharmony_ci#include "node_model.h"
2723b3eb3cSopenharmony_ci
2823b3eb3cSopenharmony_ciusing namespace testing;
2923b3eb3cSopenharmony_ciusing namespace testing::ext;
3023b3eb3cSopenharmony_ciusing namespace OHOS::Ace::DialogModel;
3123b3eb3cSopenharmony_ci
3223b3eb3cSopenharmony_ciclass DialogModelTest : public testing::Test {
3323b3eb3cSopenharmony_cipublic:
3423b3eb3cSopenharmony_ci    static void SetUpTestCase() {};
3523b3eb3cSopenharmony_ci    static void TearDownTestCase() {};
3623b3eb3cSopenharmony_ci};
3723b3eb3cSopenharmony_ci
3823b3eb3cSopenharmony_cibool OnWillDismissEvent(int32_t reason)
3923b3eb3cSopenharmony_ci{
4023b3eb3cSopenharmony_ci    return true;
4123b3eb3cSopenharmony_ci}
4223b3eb3cSopenharmony_ci
4323b3eb3cSopenharmony_ci/**
4423b3eb3cSopenharmony_ci * @tc.name: DialogModelTest001
4523b3eb3cSopenharmony_ci * @tc.desc: Test Create function.
4623b3eb3cSopenharmony_ci * @tc.type: FUNC
4723b3eb3cSopenharmony_ci */
4823b3eb3cSopenharmony_ciHWTEST_F(DialogModelTest, DialogModelTest001, TestSize.Level1)
4923b3eb3cSopenharmony_ci{
5023b3eb3cSopenharmony_ci    ArkUI_NativeDialogHandle nativeDialogHandle = Create();
5123b3eb3cSopenharmony_ci    ASSERT_EQ(nativeDialogHandle, nullptr);
5223b3eb3cSopenharmony_ci
5323b3eb3cSopenharmony_ci    Dispose(nativeDialogHandle);
5423b3eb3cSopenharmony_ci}
5523b3eb3cSopenharmony_ci
5623b3eb3cSopenharmony_ci/**
5723b3eb3cSopenharmony_ci * @tc.name: DialogModelTest002
5823b3eb3cSopenharmony_ci * @tc.desc: Test Create function.
5923b3eb3cSopenharmony_ci * @tc.type: FUNC
6023b3eb3cSopenharmony_ci */
6123b3eb3cSopenharmony_ciHWTEST_F(DialogModelTest, DialogModelTest002, TestSize.Level1)
6223b3eb3cSopenharmony_ci{
6323b3eb3cSopenharmony_ci    ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
6423b3eb3cSopenharmony_ci    ArkUI_NativeDialogHandle nativeDialogHandle = Create();
6523b3eb3cSopenharmony_ci    ASSERT_NE(nativeDialogHandle, nullptr);
6623b3eb3cSopenharmony_ci
6723b3eb3cSopenharmony_ci    Dispose(nativeDialogHandle);
6823b3eb3cSopenharmony_ci    nativeDialogHandle = nullptr;
6923b3eb3cSopenharmony_ci}
7023b3eb3cSopenharmony_ci
7123b3eb3cSopenharmony_ci/**
7223b3eb3cSopenharmony_ci * @tc.name: DialogModelTest003
7323b3eb3cSopenharmony_ci * @tc.desc: Test SetContent function.
7423b3eb3cSopenharmony_ci * @tc.type: FUNC
7523b3eb3cSopenharmony_ci */
7623b3eb3cSopenharmony_ciHWTEST_F(DialogModelTest, DialogModelTest003, TestSize.Level1)
7723b3eb3cSopenharmony_ci{
7823b3eb3cSopenharmony_ci    int32_t ret = SetContent(nullptr, nullptr);
7923b3eb3cSopenharmony_ci    ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
8023b3eb3cSopenharmony_ci}
8123b3eb3cSopenharmony_ci
8223b3eb3cSopenharmony_ci/**
8323b3eb3cSopenharmony_ci * @tc.name: DialogModelTest004
8423b3eb3cSopenharmony_ci * @tc.desc: Test SetContent function.
8523b3eb3cSopenharmony_ci * @tc.type: FUNC
8623b3eb3cSopenharmony_ci */
8723b3eb3cSopenharmony_ciHWTEST_F(DialogModelTest, DialogModelTest004, TestSize.Level1)
8823b3eb3cSopenharmony_ci{
8923b3eb3cSopenharmony_ci    ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
9023b3eb3cSopenharmony_ci    ArkUI_NativeDialogHandle nativeDialogHandle = Create();
9123b3eb3cSopenharmony_ci    ASSERT_NE(nativeDialogHandle, nullptr);
9223b3eb3cSopenharmony_ci    ArkUI_NodeHandle nodeHandle = new ArkUI_Node();
9323b3eb3cSopenharmony_ci    int32_t ret = SetContent(nativeDialogHandle, nodeHandle);
9423b3eb3cSopenharmony_ci    ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
9523b3eb3cSopenharmony_ci    Dispose(nativeDialogHandle);
9623b3eb3cSopenharmony_ci    nativeDialogHandle = nullptr;
9723b3eb3cSopenharmony_ci    delete nodeHandle;
9823b3eb3cSopenharmony_ci}
9923b3eb3cSopenharmony_ci
10023b3eb3cSopenharmony_ci/**
10123b3eb3cSopenharmony_ci * @tc.name: DialogModelTest005
10223b3eb3cSopenharmony_ci * @tc.desc: Test RemoveContent function.
10323b3eb3cSopenharmony_ci * @tc.type: FUNC
10423b3eb3cSopenharmony_ci */
10523b3eb3cSopenharmony_ciHWTEST_F(DialogModelTest, DialogModelTest005, TestSize.Level1)
10623b3eb3cSopenharmony_ci{
10723b3eb3cSopenharmony_ci    int32_t ret = RemoveContent(nullptr);
10823b3eb3cSopenharmony_ci    ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
10923b3eb3cSopenharmony_ci}
11023b3eb3cSopenharmony_ci
11123b3eb3cSopenharmony_ci/**
11223b3eb3cSopenharmony_ci * @tc.name: DialogModelTest006
11323b3eb3cSopenharmony_ci * @tc.desc: Test RemoveContent function.
11423b3eb3cSopenharmony_ci * @tc.type: FUNC
11523b3eb3cSopenharmony_ci */
11623b3eb3cSopenharmony_ciHWTEST_F(DialogModelTest, DialogModelTest006, TestSize.Level1)
11723b3eb3cSopenharmony_ci{
11823b3eb3cSopenharmony_ci    ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
11923b3eb3cSopenharmony_ci    ArkUI_NativeDialogHandle nativeDialogHandle = Create();
12023b3eb3cSopenharmony_ci    ASSERT_NE(nativeDialogHandle, nullptr);
12123b3eb3cSopenharmony_ci    int32_t ret = RemoveContent(nativeDialogHandle);
12223b3eb3cSopenharmony_ci    ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR);
12323b3eb3cSopenharmony_ci    Dispose(nativeDialogHandle);
12423b3eb3cSopenharmony_ci    nativeDialogHandle = nullptr;
12523b3eb3cSopenharmony_ci}
12623b3eb3cSopenharmony_ci
12723b3eb3cSopenharmony_ci/**
12823b3eb3cSopenharmony_ci * @tc.name: DialogModelTest007
12923b3eb3cSopenharmony_ci * @tc.desc: Test SetContentAlignment function.
13023b3eb3cSopenharmony_ci * @tc.type: FUNC
13123b3eb3cSopenharmony_ci */
13223b3eb3cSopenharmony_ciHWTEST_F(DialogModelTest, DialogModelTest007, TestSize.Level1)
13323b3eb3cSopenharmony_ci{
13423b3eb3cSopenharmony_ci    int32_t ret = SetContentAlignment(nullptr, 0, 0.0f, 0.0f);
13523b3eb3cSopenharmony_ci    ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
13623b3eb3cSopenharmony_ci}
13723b3eb3cSopenharmony_ci
13823b3eb3cSopenharmony_ci/**
13923b3eb3cSopenharmony_ci * @tc.name: DialogModelTest008
14023b3eb3cSopenharmony_ci * @tc.desc: Test SetContentAlignment function.
14123b3eb3cSopenharmony_ci * @tc.type: FUNC
14223b3eb3cSopenharmony_ci */
14323b3eb3cSopenharmony_ciHWTEST_F(DialogModelTest, DialogModelTest008, TestSize.Level1)
14423b3eb3cSopenharmony_ci{
14523b3eb3cSopenharmony_ci    ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
14623b3eb3cSopenharmony_ci    ArkUI_NativeDialogHandle nativeDialogHandle = Create();
14723b3eb3cSopenharmony_ci    ASSERT_NE(nativeDialogHandle, nullptr);
14823b3eb3cSopenharmony_ci    int32_t ret = SetContentAlignment(nativeDialogHandle, 0, 0.0f, 0.0f);
14923b3eb3cSopenharmony_ci    ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR);
15023b3eb3cSopenharmony_ci    Dispose(nativeDialogHandle);
15123b3eb3cSopenharmony_ci    nativeDialogHandle = nullptr;
15223b3eb3cSopenharmony_ci}
15323b3eb3cSopenharmony_ci
15423b3eb3cSopenharmony_ci/**
15523b3eb3cSopenharmony_ci * @tc.name: DialogModelTest009
15623b3eb3cSopenharmony_ci * @tc.desc: Test ResetContentAlignment function.
15723b3eb3cSopenharmony_ci * @tc.type: FUNC
15823b3eb3cSopenharmony_ci */
15923b3eb3cSopenharmony_ciHWTEST_F(DialogModelTest, DialogModelTest009, TestSize.Level1)
16023b3eb3cSopenharmony_ci{
16123b3eb3cSopenharmony_ci    int32_t ret = ResetContentAlignment(nullptr);
16223b3eb3cSopenharmony_ci    ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
16323b3eb3cSopenharmony_ci}
16423b3eb3cSopenharmony_ci
16523b3eb3cSopenharmony_ci/**
16623b3eb3cSopenharmony_ci * @tc.name: DialogModelTest010
16723b3eb3cSopenharmony_ci * @tc.desc: Test SetContentAlignment function.
16823b3eb3cSopenharmony_ci * @tc.type: FUNC
16923b3eb3cSopenharmony_ci */
17023b3eb3cSopenharmony_ciHWTEST_F(DialogModelTest, DialogModelTest010, TestSize.Level1)
17123b3eb3cSopenharmony_ci{
17223b3eb3cSopenharmony_ci    ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
17323b3eb3cSopenharmony_ci    ArkUI_NativeDialogHandle nativeDialogHandle = Create();
17423b3eb3cSopenharmony_ci    ASSERT_NE(nativeDialogHandle, nullptr);
17523b3eb3cSopenharmony_ci    int32_t ret = ResetContentAlignment(nativeDialogHandle);
17623b3eb3cSopenharmony_ci    ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR);
17723b3eb3cSopenharmony_ci    Dispose(nativeDialogHandle);
17823b3eb3cSopenharmony_ci    nativeDialogHandle = nullptr;
17923b3eb3cSopenharmony_ci}
18023b3eb3cSopenharmony_ci
18123b3eb3cSopenharmony_ci/**
18223b3eb3cSopenharmony_ci * @tc.name: DialogModelTest011
18323b3eb3cSopenharmony_ci * @tc.desc: Test SetModalMode function.
18423b3eb3cSopenharmony_ci * @tc.type: FUNC
18523b3eb3cSopenharmony_ci */
18623b3eb3cSopenharmony_ciHWTEST_F(DialogModelTest, DialogModelTest011, TestSize.Level1)
18723b3eb3cSopenharmony_ci{
18823b3eb3cSopenharmony_ci    int32_t ret = SetModalMode(nullptr, true);
18923b3eb3cSopenharmony_ci    ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
19023b3eb3cSopenharmony_ci}
19123b3eb3cSopenharmony_ci
19223b3eb3cSopenharmony_ci/**
19323b3eb3cSopenharmony_ci * @tc.name: DialogModelTest012
19423b3eb3cSopenharmony_ci * @tc.desc: Test SetModalMode function.
19523b3eb3cSopenharmony_ci * @tc.type: FUNC
19623b3eb3cSopenharmony_ci */
19723b3eb3cSopenharmony_ciHWTEST_F(DialogModelTest, DialogModelTest012, TestSize.Level1)
19823b3eb3cSopenharmony_ci{
19923b3eb3cSopenharmony_ci    ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
20023b3eb3cSopenharmony_ci    ArkUI_NativeDialogHandle nativeDialogHandle = Create();
20123b3eb3cSopenharmony_ci    ASSERT_NE(nativeDialogHandle, nullptr);
20223b3eb3cSopenharmony_ci    int32_t ret = SetModalMode(nativeDialogHandle, true);
20323b3eb3cSopenharmony_ci    ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR);
20423b3eb3cSopenharmony_ci    Dispose(nativeDialogHandle);
20523b3eb3cSopenharmony_ci    nativeDialogHandle = nullptr;
20623b3eb3cSopenharmony_ci}
20723b3eb3cSopenharmony_ci
20823b3eb3cSopenharmony_ci/**
20923b3eb3cSopenharmony_ci * @tc.name: DialogModelTest013
21023b3eb3cSopenharmony_ci * @tc.desc: Test SetAutoCancel function.
21123b3eb3cSopenharmony_ci * @tc.type: FUNC
21223b3eb3cSopenharmony_ci */
21323b3eb3cSopenharmony_ciHWTEST_F(DialogModelTest, DialogModelTest013, TestSize.Level1)
21423b3eb3cSopenharmony_ci{
21523b3eb3cSopenharmony_ci    int32_t ret = SetAutoCancel(nullptr, true);
21623b3eb3cSopenharmony_ci    ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
21723b3eb3cSopenharmony_ci}
21823b3eb3cSopenharmony_ci
21923b3eb3cSopenharmony_ci/**
22023b3eb3cSopenharmony_ci * @tc.name: DialogModelTest014
22123b3eb3cSopenharmony_ci * @tc.desc: Test SetAutoCancel function.
22223b3eb3cSopenharmony_ci * @tc.type: FUNC
22323b3eb3cSopenharmony_ci */
22423b3eb3cSopenharmony_ciHWTEST_F(DialogModelTest, DialogModelTest014, TestSize.Level1)
22523b3eb3cSopenharmony_ci{
22623b3eb3cSopenharmony_ci    ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
22723b3eb3cSopenharmony_ci    ArkUI_NativeDialogHandle nativeDialogHandle = Create();
22823b3eb3cSopenharmony_ci    ASSERT_NE(nativeDialogHandle, nullptr);
22923b3eb3cSopenharmony_ci    int32_t ret = SetAutoCancel(nativeDialogHandle, true);
23023b3eb3cSopenharmony_ci    ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR);
23123b3eb3cSopenharmony_ci    Dispose(nativeDialogHandle);
23223b3eb3cSopenharmony_ci    nativeDialogHandle = nullptr;
23323b3eb3cSopenharmony_ci}
23423b3eb3cSopenharmony_ci
23523b3eb3cSopenharmony_ci/**
23623b3eb3cSopenharmony_ci * @tc.name: DialogModelTest015
23723b3eb3cSopenharmony_ci * @tc.desc: Test SetMask function.
23823b3eb3cSopenharmony_ci * @tc.type: FUNC
23923b3eb3cSopenharmony_ci */
24023b3eb3cSopenharmony_ciHWTEST_F(DialogModelTest, DialogModelTest015, TestSize.Level1)
24123b3eb3cSopenharmony_ci{
24223b3eb3cSopenharmony_ci    int32_t ret = SetMask(nullptr, 0, nullptr);
24323b3eb3cSopenharmony_ci    ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
24423b3eb3cSopenharmony_ci}
24523b3eb3cSopenharmony_ci
24623b3eb3cSopenharmony_ci/**
24723b3eb3cSopenharmony_ci * @tc.name: DialogModelTest016
24823b3eb3cSopenharmony_ci * @tc.desc: Test SetMask function.
24923b3eb3cSopenharmony_ci * @tc.type: FUNC
25023b3eb3cSopenharmony_ci */
25123b3eb3cSopenharmony_ciHWTEST_F(DialogModelTest, DialogModelTest016, TestSize.Level1)
25223b3eb3cSopenharmony_ci{
25323b3eb3cSopenharmony_ci    ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
25423b3eb3cSopenharmony_ci    ArkUI_NativeDialogHandle nativeDialogHandle = Create();
25523b3eb3cSopenharmony_ci    ASSERT_NE(nativeDialogHandle, nullptr);
25623b3eb3cSopenharmony_ci    ArkUI_Rect rect = {0.0f, 0.0f, 0.0f, 0.0f};
25723b3eb3cSopenharmony_ci    int32_t ret = SetMask(nativeDialogHandle, 0, &rect);
25823b3eb3cSopenharmony_ci    ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR);
25923b3eb3cSopenharmony_ci    Dispose(nativeDialogHandle);
26023b3eb3cSopenharmony_ci    nativeDialogHandle = nullptr;
26123b3eb3cSopenharmony_ci}
26223b3eb3cSopenharmony_ci
26323b3eb3cSopenharmony_ci/**
26423b3eb3cSopenharmony_ci * @tc.name: DialogModelTest017
26523b3eb3cSopenharmony_ci * @tc.desc: Test SetMask function.
26623b3eb3cSopenharmony_ci * @tc.type: FUNC
26723b3eb3cSopenharmony_ci */
26823b3eb3cSopenharmony_ciHWTEST_F(DialogModelTest, DialogModelTest017, TestSize.Level1)
26923b3eb3cSopenharmony_ci{
27023b3eb3cSopenharmony_ci    ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
27123b3eb3cSopenharmony_ci    ArkUI_NativeDialogHandle nativeDialogHandle = Create();
27223b3eb3cSopenharmony_ci    ASSERT_NE(nativeDialogHandle, nullptr);
27323b3eb3cSopenharmony_ci    int32_t ret = SetMask(nativeDialogHandle, 0, nullptr);
27423b3eb3cSopenharmony_ci    ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR);
27523b3eb3cSopenharmony_ci    Dispose(nativeDialogHandle);
27623b3eb3cSopenharmony_ci    nativeDialogHandle = nullptr;
27723b3eb3cSopenharmony_ci}
27823b3eb3cSopenharmony_ci
27923b3eb3cSopenharmony_ci/**
28023b3eb3cSopenharmony_ci * @tc.name: DialogModelTest018
28123b3eb3cSopenharmony_ci * @tc.desc: Test SetBackgroundColor function.
28223b3eb3cSopenharmony_ci * @tc.type: FUNC
28323b3eb3cSopenharmony_ci */
28423b3eb3cSopenharmony_ciHWTEST_F(DialogModelTest, DialogModelTest018, TestSize.Level1)
28523b3eb3cSopenharmony_ci{
28623b3eb3cSopenharmony_ci    int32_t ret = SetBackgroundColor(nullptr, 0);
28723b3eb3cSopenharmony_ci    ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
28823b3eb3cSopenharmony_ci}
28923b3eb3cSopenharmony_ci
29023b3eb3cSopenharmony_ci/**
29123b3eb3cSopenharmony_ci * @tc.name: DialogModelTest019
29223b3eb3cSopenharmony_ci * @tc.desc: Test SetBackgroundColor function.
29323b3eb3cSopenharmony_ci * @tc.type: FUNC
29423b3eb3cSopenharmony_ci */
29523b3eb3cSopenharmony_ciHWTEST_F(DialogModelTest, DialogModelTest019, TestSize.Level1)
29623b3eb3cSopenharmony_ci{
29723b3eb3cSopenharmony_ci    ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
29823b3eb3cSopenharmony_ci    ArkUI_NativeDialogHandle nativeDialogHandle = Create();
29923b3eb3cSopenharmony_ci    ASSERT_NE(nativeDialogHandle, nullptr);
30023b3eb3cSopenharmony_ci    int32_t ret = SetBackgroundColor(nativeDialogHandle, 0);
30123b3eb3cSopenharmony_ci    ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR);
30223b3eb3cSopenharmony_ci    Dispose(nativeDialogHandle);
30323b3eb3cSopenharmony_ci    nativeDialogHandle = nullptr;
30423b3eb3cSopenharmony_ci}
30523b3eb3cSopenharmony_ci
30623b3eb3cSopenharmony_ci/**
30723b3eb3cSopenharmony_ci * @tc.name: DialogModelTest020
30823b3eb3cSopenharmony_ci * @tc.desc: Test SetCornerRadius function.
30923b3eb3cSopenharmony_ci * @tc.type: FUNC
31023b3eb3cSopenharmony_ci */
31123b3eb3cSopenharmony_ciHWTEST_F(DialogModelTest, DialogModelTest020, TestSize.Level1)
31223b3eb3cSopenharmony_ci{
31323b3eb3cSopenharmony_ci    int32_t ret = SetCornerRadius(nullptr, 0.0f, 0.0f, 0.0f, 0.0f);
31423b3eb3cSopenharmony_ci    ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
31523b3eb3cSopenharmony_ci}
31623b3eb3cSopenharmony_ci
31723b3eb3cSopenharmony_ci/**
31823b3eb3cSopenharmony_ci * @tc.name: DialogModelTest021
31923b3eb3cSopenharmony_ci * @tc.desc: Test SetCornerRadius function.
32023b3eb3cSopenharmony_ci * @tc.type: FUNC
32123b3eb3cSopenharmony_ci */
32223b3eb3cSopenharmony_ciHWTEST_F(DialogModelTest, DialogModelTest021, TestSize.Level1)
32323b3eb3cSopenharmony_ci{
32423b3eb3cSopenharmony_ci    ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
32523b3eb3cSopenharmony_ci    ArkUI_NativeDialogHandle nativeDialogHandle = Create();
32623b3eb3cSopenharmony_ci    ASSERT_NE(nativeDialogHandle, nullptr);
32723b3eb3cSopenharmony_ci    int32_t ret = SetCornerRadius(nativeDialogHandle, 0.0f, 0.0f, 0.0f, 0.0f);
32823b3eb3cSopenharmony_ci    ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR);
32923b3eb3cSopenharmony_ci    Dispose(nativeDialogHandle);
33023b3eb3cSopenharmony_ci    nativeDialogHandle = nullptr;
33123b3eb3cSopenharmony_ci}
33223b3eb3cSopenharmony_ci
33323b3eb3cSopenharmony_ci/**
33423b3eb3cSopenharmony_ci * @tc.name: DialogModelTest022
33523b3eb3cSopenharmony_ci * @tc.desc: Test SetGridColumnCount function.
33623b3eb3cSopenharmony_ci * @tc.type: FUNC
33723b3eb3cSopenharmony_ci */
33823b3eb3cSopenharmony_ciHWTEST_F(DialogModelTest, DialogModelTest022, TestSize.Level1)
33923b3eb3cSopenharmony_ci{
34023b3eb3cSopenharmony_ci    int32_t ret = SetGridColumnCount(nullptr, 0);
34123b3eb3cSopenharmony_ci    ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
34223b3eb3cSopenharmony_ci}
34323b3eb3cSopenharmony_ci
34423b3eb3cSopenharmony_ci/**
34523b3eb3cSopenharmony_ci * @tc.name: DialogModelTest023
34623b3eb3cSopenharmony_ci * @tc.desc: Test SetGridColumnCount function.
34723b3eb3cSopenharmony_ci * @tc.type: FUNC
34823b3eb3cSopenharmony_ci */
34923b3eb3cSopenharmony_ciHWTEST_F(DialogModelTest, DialogModelTest023, TestSize.Level1)
35023b3eb3cSopenharmony_ci{
35123b3eb3cSopenharmony_ci    ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
35223b3eb3cSopenharmony_ci    ArkUI_NativeDialogHandle nativeDialogHandle = Create();
35323b3eb3cSopenharmony_ci    ASSERT_NE(nativeDialogHandle, nullptr);
35423b3eb3cSopenharmony_ci    int32_t ret = SetGridColumnCount(nativeDialogHandle, 0);
35523b3eb3cSopenharmony_ci    ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR);
35623b3eb3cSopenharmony_ci    Dispose(nativeDialogHandle);
35723b3eb3cSopenharmony_ci    nativeDialogHandle = nullptr;
35823b3eb3cSopenharmony_ci}
35923b3eb3cSopenharmony_ci
36023b3eb3cSopenharmony_ci/**
36123b3eb3cSopenharmony_ci * @tc.name: DialogModelTest024
36223b3eb3cSopenharmony_ci * @tc.desc: Test EnableCustomStyle function.
36323b3eb3cSopenharmony_ci * @tc.type: FUNC
36423b3eb3cSopenharmony_ci */
36523b3eb3cSopenharmony_ciHWTEST_F(DialogModelTest, DialogModelTest024, TestSize.Level1)
36623b3eb3cSopenharmony_ci{
36723b3eb3cSopenharmony_ci    int32_t ret = EnableCustomStyle(nullptr, true);
36823b3eb3cSopenharmony_ci    ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
36923b3eb3cSopenharmony_ci}
37023b3eb3cSopenharmony_ci
37123b3eb3cSopenharmony_ci/**
37223b3eb3cSopenharmony_ci * @tc.name: DialogModelTest025
37323b3eb3cSopenharmony_ci * @tc.desc: Test EnableCustomStyle function.
37423b3eb3cSopenharmony_ci * @tc.type: FUNC
37523b3eb3cSopenharmony_ci */
37623b3eb3cSopenharmony_ciHWTEST_F(DialogModelTest, DialogModelTest025, TestSize.Level1)
37723b3eb3cSopenharmony_ci{
37823b3eb3cSopenharmony_ci    ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
37923b3eb3cSopenharmony_ci    ArkUI_NativeDialogHandle nativeDialogHandle = Create();
38023b3eb3cSopenharmony_ci    ASSERT_NE(nativeDialogHandle, nullptr);
38123b3eb3cSopenharmony_ci    int32_t ret = EnableCustomStyle(nativeDialogHandle, true);
38223b3eb3cSopenharmony_ci    ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR);
38323b3eb3cSopenharmony_ci    Dispose(nativeDialogHandle);
38423b3eb3cSopenharmony_ci    nativeDialogHandle = nullptr;
38523b3eb3cSopenharmony_ci}
38623b3eb3cSopenharmony_ci
38723b3eb3cSopenharmony_ci/**
38823b3eb3cSopenharmony_ci * @tc.name: DialogModelTest026
38923b3eb3cSopenharmony_ci * @tc.desc: Test EnableCustomAnimation function.
39023b3eb3cSopenharmony_ci * @tc.type: FUNC
39123b3eb3cSopenharmony_ci */
39223b3eb3cSopenharmony_ciHWTEST_F(DialogModelTest, DialogModelTest026, TestSize.Level1)
39323b3eb3cSopenharmony_ci{
39423b3eb3cSopenharmony_ci    int32_t ret = EnableCustomAnimation(nullptr, true);
39523b3eb3cSopenharmony_ci    ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
39623b3eb3cSopenharmony_ci}
39723b3eb3cSopenharmony_ci
39823b3eb3cSopenharmony_ci/**
39923b3eb3cSopenharmony_ci * @tc.name: DialogModelTest027
40023b3eb3cSopenharmony_ci * @tc.desc: Test EnableCustomAnimation function.
40123b3eb3cSopenharmony_ci * @tc.type: FUNC
40223b3eb3cSopenharmony_ci */
40323b3eb3cSopenharmony_ciHWTEST_F(DialogModelTest, DialogModelTest027, TestSize.Level1)
40423b3eb3cSopenharmony_ci{
40523b3eb3cSopenharmony_ci    ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
40623b3eb3cSopenharmony_ci    ArkUI_NativeDialogHandle nativeDialogHandle = Create();
40723b3eb3cSopenharmony_ci    ASSERT_NE(nativeDialogHandle, nullptr);
40823b3eb3cSopenharmony_ci    int32_t ret = EnableCustomAnimation(nativeDialogHandle, true);
40923b3eb3cSopenharmony_ci    ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR);
41023b3eb3cSopenharmony_ci    Dispose(nativeDialogHandle);
41123b3eb3cSopenharmony_ci    nativeDialogHandle = nullptr;
41223b3eb3cSopenharmony_ci}
41323b3eb3cSopenharmony_ci
41423b3eb3cSopenharmony_ci/**
41523b3eb3cSopenharmony_ci * @tc.name: DialogModelTest028
41623b3eb3cSopenharmony_ci * @tc.desc: Test Show function.
41723b3eb3cSopenharmony_ci * @tc.type: FUNC
41823b3eb3cSopenharmony_ci */
41923b3eb3cSopenharmony_ciHWTEST_F(DialogModelTest, DialogModelTest028, TestSize.Level1)
42023b3eb3cSopenharmony_ci{
42123b3eb3cSopenharmony_ci    int32_t ret = Show(nullptr, true);
42223b3eb3cSopenharmony_ci    ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
42323b3eb3cSopenharmony_ci}
42423b3eb3cSopenharmony_ci
42523b3eb3cSopenharmony_ci/**
42623b3eb3cSopenharmony_ci * @tc.name: DialogModelTest029
42723b3eb3cSopenharmony_ci * @tc.desc: Test Show function.
42823b3eb3cSopenharmony_ci * @tc.type: FUNC
42923b3eb3cSopenharmony_ci */
43023b3eb3cSopenharmony_ciHWTEST_F(DialogModelTest, DialogModelTest029, TestSize.Level1)
43123b3eb3cSopenharmony_ci{
43223b3eb3cSopenharmony_ci    ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
43323b3eb3cSopenharmony_ci    ArkUI_NativeDialogHandle nativeDialogHandle = Create();
43423b3eb3cSopenharmony_ci    ASSERT_NE(nativeDialogHandle, nullptr);
43523b3eb3cSopenharmony_ci    int32_t ret = Show(nativeDialogHandle, false);
43623b3eb3cSopenharmony_ci    ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
43723b3eb3cSopenharmony_ci    Dispose(nativeDialogHandle);
43823b3eb3cSopenharmony_ci    nativeDialogHandle = nullptr;
43923b3eb3cSopenharmony_ci}
44023b3eb3cSopenharmony_ci
44123b3eb3cSopenharmony_ci/**
44223b3eb3cSopenharmony_ci * @tc.name: DialogModelTest030
44323b3eb3cSopenharmony_ci * @tc.desc: Test Close function.
44423b3eb3cSopenharmony_ci * @tc.type: FUNC
44523b3eb3cSopenharmony_ci */
44623b3eb3cSopenharmony_ciHWTEST_F(DialogModelTest, DialogModelTest030, TestSize.Level1)
44723b3eb3cSopenharmony_ci{
44823b3eb3cSopenharmony_ci    int32_t ret = Close(nullptr);
44923b3eb3cSopenharmony_ci    ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
45023b3eb3cSopenharmony_ci}
45123b3eb3cSopenharmony_ci
45223b3eb3cSopenharmony_ci/**
45323b3eb3cSopenharmony_ci * @tc.name: DialogModelTest031
45423b3eb3cSopenharmony_ci * @tc.desc: Test Close function.
45523b3eb3cSopenharmony_ci * @tc.type: FUNC
45623b3eb3cSopenharmony_ci */
45723b3eb3cSopenharmony_ciHWTEST_F(DialogModelTest, DialogModelTest031, TestSize.Level1)
45823b3eb3cSopenharmony_ci{
45923b3eb3cSopenharmony_ci    ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
46023b3eb3cSopenharmony_ci    ArkUI_NativeDialogHandle nativeDialogHandle = Create();
46123b3eb3cSopenharmony_ci    ASSERT_NE(nativeDialogHandle, nullptr);
46223b3eb3cSopenharmony_ci    int32_t ret = Close(nativeDialogHandle);
46323b3eb3cSopenharmony_ci    ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
46423b3eb3cSopenharmony_ci    Dispose(nativeDialogHandle);
46523b3eb3cSopenharmony_ci    nativeDialogHandle = nullptr;
46623b3eb3cSopenharmony_ci}
46723b3eb3cSopenharmony_ci
46823b3eb3cSopenharmony_ci/**
46923b3eb3cSopenharmony_ci * @tc.name: DialogModelTest032
47023b3eb3cSopenharmony_ci * @tc.desc: Test RegisterOnWillDismiss function.
47123b3eb3cSopenharmony_ci * @tc.type: FUNC
47223b3eb3cSopenharmony_ci */
47323b3eb3cSopenharmony_ciHWTEST_F(DialogModelTest, DialogModelTest032, TestSize.Level1)
47423b3eb3cSopenharmony_ci{
47523b3eb3cSopenharmony_ci    int32_t ret = RegisterOnWillDismiss(nullptr, nullptr);
47623b3eb3cSopenharmony_ci    ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
47723b3eb3cSopenharmony_ci}
47823b3eb3cSopenharmony_ci
47923b3eb3cSopenharmony_ci/**
48023b3eb3cSopenharmony_ci * @tc.name: DialogModelTest033
48123b3eb3cSopenharmony_ci * @tc.desc: Test RegisterOnWillDismiss function.
48223b3eb3cSopenharmony_ci * @tc.type: FUNC
48323b3eb3cSopenharmony_ci */
48423b3eb3cSopenharmony_ciHWTEST_F(DialogModelTest, DialogModelTest033, TestSize.Level1)
48523b3eb3cSopenharmony_ci{
48623b3eb3cSopenharmony_ci    ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
48723b3eb3cSopenharmony_ci    ArkUI_NativeDialogHandle nativeDialogHandle = Create();
48823b3eb3cSopenharmony_ci    ASSERT_NE(nativeDialogHandle, nullptr);
48923b3eb3cSopenharmony_ci    ArkUI_OnWillDismissEvent eventHandler = OnWillDismissEvent;
49023b3eb3cSopenharmony_ci    int32_t ret = RegisterOnWillDismiss(nativeDialogHandle, eventHandler);
49123b3eb3cSopenharmony_ci    ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_NO_ERROR);
49223b3eb3cSopenharmony_ci    Dispose(nativeDialogHandle);
49323b3eb3cSopenharmony_ci    nativeDialogHandle = nullptr;
49423b3eb3cSopenharmony_ci}
49523b3eb3cSopenharmony_ci
49623b3eb3cSopenharmony_ci/**
49723b3eb3cSopenharmony_ci * @tc.name: DialogModelTest034
49823b3eb3cSopenharmony_ci * @tc.desc: Test RegisterOnWillDismissWithUserData function.
49923b3eb3cSopenharmony_ci * @tc.type: FUNC
50023b3eb3cSopenharmony_ci */
50123b3eb3cSopenharmony_ciHWTEST_F(DialogModelTest, DialogModelTest034, TestSize.Level1)
50223b3eb3cSopenharmony_ci{
50323b3eb3cSopenharmony_ci    ASSERT_TRUE(OHOS::Ace::NodeModel::InitialFullImpl());
50423b3eb3cSopenharmony_ci    ArkUI_NativeDialogHandle nativeDialogHandle = Create();
50523b3eb3cSopenharmony_ci    ASSERT_NE(nativeDialogHandle, nullptr);
50623b3eb3cSopenharmony_ci    ArkUI_DialogDismissEvent nEvent;
50723b3eb3cSopenharmony_ci    int32_t ret =
50823b3eb3cSopenharmony_ci        RegisterOnWillDismissWithUserData(nativeDialogHandle, nEvent.userData, [](ArkUI_DialogDismissEvent* event) {});
50923b3eb3cSopenharmony_ci    ASSERT_EQ(ret, 0);
51023b3eb3cSopenharmony_ci    ret = RegisterOnWillDismissWithUserData(nullptr, nullptr, nullptr);
51123b3eb3cSopenharmony_ci    ASSERT_EQ(ret, OHOS::Ace::ERROR_CODE_PARAM_INVALID);
51223b3eb3cSopenharmony_ci    Dispose(nativeDialogHandle);
51323b3eb3cSopenharmony_ci    nativeDialogHandle = nullptr;
51423b3eb3cSopenharmony_ci}
51523b3eb3cSopenharmony_ci
51623b3eb3cSopenharmony_ci/**
51723b3eb3cSopenharmony_ci * @tc.name: DialogModelTest035
51823b3eb3cSopenharmony_ci * @tc.desc: Test ArkUI_DialogDismissEvent_SetShouldBlockDismiss function.
51923b3eb3cSopenharmony_ci * @tc.type: FUNC
52023b3eb3cSopenharmony_ci */
52123b3eb3cSopenharmony_ciHWTEST_F(DialogModelTest, DialogModelTest035, TestSize.Level1)
52223b3eb3cSopenharmony_ci{
52323b3eb3cSopenharmony_ci    ArkUI_DialogDismissEvent* nEvent = new ArkUI_DialogDismissEvent({ nullptr, 0, false });
52423b3eb3cSopenharmony_ci    OH_ArkUI_DialogDismissEvent_SetShouldBlockDismiss(nEvent, true);
52523b3eb3cSopenharmony_ci    ASSERT_TRUE(nEvent->BlockDismiss);
52623b3eb3cSopenharmony_ci    nEvent = nullptr;
52723b3eb3cSopenharmony_ci    OH_ArkUI_DialogDismissEvent_SetShouldBlockDismiss(nEvent, true);
52823b3eb3cSopenharmony_ci    ASSERT_TRUE(nEvent == nullptr);
52923b3eb3cSopenharmony_ci}
53023b3eb3cSopenharmony_ci
53123b3eb3cSopenharmony_ci/**
53223b3eb3cSopenharmony_ci * @tc.name: DialogModelTest036
53323b3eb3cSopenharmony_ci * @tc.desc: Test ArkUI_DialogDismissEvent_GetUserData function.
53423b3eb3cSopenharmony_ci * @tc.type: FUNC
53523b3eb3cSopenharmony_ci */
53623b3eb3cSopenharmony_ciHWTEST_F(DialogModelTest, DialogModelTest036, TestSize.Level1)
53723b3eb3cSopenharmony_ci{
53823b3eb3cSopenharmony_ci    struct ArkUICustomData {
53923b3eb3cSopenharmony_ci        float id;
54023b3eb3cSopenharmony_ci        int index;
54123b3eb3cSopenharmony_ci    };
54223b3eb3cSopenharmony_ci    auto customData = new ArkUICustomData { 12, 1 };
54323b3eb3cSopenharmony_ci    ArkUI_DialogDismissEvent* nEvent = new ArkUI_DialogDismissEvent({ nullptr, 0, false });
54423b3eb3cSopenharmony_ci    nEvent->userData = customData;
54523b3eb3cSopenharmony_ci    void* ret = OH_ArkUI_DialogDismissEvent_GetUserData(nEvent);
54623b3eb3cSopenharmony_ci    ASSERT_EQ(ret, nEvent->userData);
54723b3eb3cSopenharmony_ci    nEvent = nullptr;
54823b3eb3cSopenharmony_ci    ret = OH_ArkUI_DialogDismissEvent_GetUserData(nEvent);
54923b3eb3cSopenharmony_ci    ASSERT_TRUE(ret == nullptr);
55023b3eb3cSopenharmony_ci}
55123b3eb3cSopenharmony_ci
55223b3eb3cSopenharmony_ci/**
55323b3eb3cSopenharmony_ci * @tc.name: DialogModelTest037
55423b3eb3cSopenharmony_ci * @tc.desc: Test ArkUI_DialogDismissEvent_GetUserData function.
55523b3eb3cSopenharmony_ci * @tc.type: FUNC
55623b3eb3cSopenharmony_ci */
55723b3eb3cSopenharmony_ciHWTEST_F(DialogModelTest, DialogModelTest037, TestSize.Level1)
55823b3eb3cSopenharmony_ci{
55923b3eb3cSopenharmony_ci    ArkUI_DialogDismissEvent* nEvent = new ArkUI_DialogDismissEvent({ nullptr, 0, false });
56023b3eb3cSopenharmony_ci    int32_t ret = OH_ArkUI_DialogDismissEvent_GetDismissReason(nEvent);
56123b3eb3cSopenharmony_ci    ASSERT_EQ(ret, nEvent->reason);
56223b3eb3cSopenharmony_ci    nEvent = nullptr;
56323b3eb3cSopenharmony_ci    ret = OH_ArkUI_DialogDismissEvent_GetDismissReason(nEvent);
56423b3eb3cSopenharmony_ci    ASSERT_EQ(ret, -1);
56523b3eb3cSopenharmony_ci}