/*
 * Copyright (c) 2024 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "swiper_modifier_test.h"

#include "modifier_test_base.h"
#include "modifiers_test_utils.h"

#include "bridge/common/utils/utils.h"
#include "core/interfaces/native/utility/converter.h"
#include "core/interfaces/native/utility/reverse_converter.h"
#include "core/interfaces/native/utility/peer_utils.h"

#include "core/components/common/layout/constants.h"
#include "core/components/swiper/swiper_indicator_theme.h"
#include "core/components_ng/pattern/swiper/swiper_pattern.h"

namespace OHOS::Ace::NG {

using namespace testing;
using namespace testing::ext;
using namespace Converter;

namespace {
const Ark_Boolean ABOOL_TRUE(true);
const Ark_Boolean ABOOL_FALSE(false);
const Ark_Int32 AINT32_POS(1234);
const Ark_Int32 AINT32_NEG(INT_MIN);
const Ark_Float32 AFLT32_POS(1.234f);
const Ark_Float32 AFLT32_NEG(-5.6789f);
const double DEFAULT_SWIPER_ANIMATION_DURATION = 500.0;
const double DEFAULT_SWIPER_AUTOPLAY_INTERVAL = 3000.0;
const int32_t DEFAULT_SWIPER_CACHED_SIZE = -1;
const int32_t DEFAULT_SWIPER_DISPLAY_COUNT = 1;

const auto ANUM_INT_POS = ArkValue<Ark_Number>(AINT32_POS);
const auto ANUM_INT_NEG = ArkValue<Ark_Number>(AINT32_NEG);
const auto ASTR_INVALID = ArkValue<Ark_String>("(*%^&#@");

const auto ALEN_VP_POS = ArkValue<Ark_Length>(AFLT32_POS);
const auto ALEN_VP_NEG = ArkValue<Ark_Length>(AFLT32_NEG);

const auto OPT_LEN_VP_POS = ArkValue<Opt_Length>(AFLT32_POS);
const auto OPT_LEN_VP_NEG = ArkValue<Opt_Length>(AFLT32_NEG);
const auto OPT_LEN_UNDEF = ArkValue<Opt_Length>();

const auto OPT_BOOL_UNDEF = ArkValue<Opt_Boolean>(Ark_Empty());
const auto OPT_BOOL_TRUE = ArkValue<Opt_Boolean>(true);
const auto OPT_BOOL_FALSE = ArkValue<Opt_Boolean>(false);

const auto OPT_COLOR_UNDEF = ArkValue<Opt_ResourceColor>();

constexpr auto EXPECTED_TRUE = "true";
constexpr auto EXPECTED_FALSE = "false";
const std::string EXPECTED_VP_ZERO(Dimension(0, DimensionUnit::VP).ToString());
const std::string EXPECTED_PX_POS(Dimension(AINT32_POS, DimensionUnit::PX).ToString());
const std::string EXPECTED_VP_POS(Dimension(AFLT32_POS, DimensionUnit::VP).ToString());

const Dimension THEME_SWIPER_INDICATOR_SIZE(9876, DimensionUnit::VP);
const Dimension THEME_SWIPER_FONT_SIZE(321, DimensionUnit::PX);
const Color THEME_SWIPER_INDICATOR_COLOR(Color::BLUE);
const Color THEME_SWIPER_ARROW_COLOR(Color::GREEN);

const auto RES_NAME = NamedResourceId("aa.bb.cc", ResourceType::COLOR);
const auto RES_ID = IntResourceId(1234, ResourceType::COLOR);
const auto CONTEXT_ID = 123;
} // namespace

class SwiperModifierTest : public ModifierTestBase<GENERATED_ArkUISwiperModifier,
    &GENERATED_ArkUINodeModifiers::getSwiperModifier, GENERATED_ARKUI_SWIPER> {
public:
    static void SetUpTestCase()
    {
        ModifierTestBase::SetUpTestCase();

        // set test values to Theme Pattern as data for the Theme building
        auto themeStyle = SetupThemeStyle("swiper_pattern");
        themeStyle->SetAttr("swiper_indicator_size", { .value = THEME_SWIPER_INDICATOR_SIZE });
        themeStyle->SetAttr("indicator_color", { .value = THEME_SWIPER_INDICATOR_COLOR });
        themeStyle->SetAttr("indicator_color_selected", { .value = THEME_SWIPER_INDICATOR_COLOR });
        themeStyle->SetAttr("indicator_text_font_size", { .value = THEME_SWIPER_FONT_SIZE });
        themeStyle->SetAttr(ARROW_COLOR_PRIMARY, { .value = THEME_SWIPER_ARROW_COLOR });
        themeStyle->SetAttr(ARROW_COLOR_COMPONENT_NORMAL, { .value = THEME_SWIPER_ARROW_COLOR });

        SetupTheme<SwiperIndicatorTheme>();
    }
};

/**
 * @tc.name: setIndexTest
 * @tc.desc: Check the functionality of SwiperModifier.IndexImpl
 * @tc.type: FUNC
 */
HWTEST_F(SwiperModifierTest, setIndexTest, TestSize.Level1)
{
    constexpr auto propName = "index";
    constexpr auto defaultValue = "0";
    ASSERT_NE(modifier_->setIndex, nullptr);

    auto input = ArkUnion<Opt_Union_I32_Bindable, Ark_Int32>(123456);
    modifier_->setIndex(node_, &input);
    auto checkVal2 = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkVal2, Eq("123456"));

    input = ArkUnion<Opt_Union_I32_Bindable, Ark_Int32>(0);
    modifier_->setIndex(node_, &input);
    auto checkVal3 = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkVal3, Eq("0"));

    input = ArkUnion<Opt_Union_I32_Bindable, Ark_Int32>(1);
    modifier_->setIndex(node_, &input);
    auto checkVal4 = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkVal4, Eq("1"));

    input = ArkUnion<Opt_Union_I32_Bindable, Ark_Int32>(-1);
    modifier_->setIndex(node_, &input);
    auto checkVal5 = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkVal5, Eq(defaultValue));
}
/**
 * @tc.name: setAutoPlay0Test
 * @tc.desc: Check the functionality of SwiperModifier.AutoPlayImpl
 * @tc.type: FUNC
 */
HWTEST_F(SwiperModifierTest, setAutoPlay0Test, TestSize.Level1)
{
    constexpr auto propName = "autoPlay";
    const std::string &defaultValue(EXPECTED_FALSE);
    ASSERT_NE(modifier_->setAutoPlay0, nullptr);

    auto checkInitial = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkInitial, Eq(defaultValue));

    modifier_->setAutoPlay0(node_, &OPT_BOOL_TRUE);
    auto checkVal2 = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkVal2, Eq(EXPECTED_TRUE));

    modifier_->setAutoPlay0(node_, &OPT_BOOL_FALSE);
    auto checkVal3 = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkVal3, Eq(EXPECTED_FALSE));
}
/**
 * @tc.name: setAutoPlay1TestVariant2Arg
 * @tc.desc: Check the functionality of SwiperModifier.AutoPlay1Impl
 * @tc.type: FUNC
 */
HWTEST_F(SwiperModifierTest, setAutoPlay1TestVariant2Arg, TestSize.Level1)
{
    const std::string propNameAutoPlay("autoPlay");
    const std::string &autoPlayDefault(EXPECTED_FALSE);
    const std::string propNameAutoPlayOptions("stopWhenTouched");
    const std::string &autoPlayOptionsDefault(EXPECTED_TRUE);

    ASSERT_NE(modifier_->setAutoPlay1, nullptr);

    auto checkAutoPlay = GetAttrValue<std::string>(node_, propNameAutoPlay);
    EXPECT_THAT(checkAutoPlay, Eq(autoPlayDefault));
    auto checkAutoPlayOptions = GetAttrValue<std::string>(node_, propNameAutoPlayOptions);
    EXPECT_THAT(checkAutoPlayOptions, Eq(autoPlayOptionsDefault));

    Ark_AutoPlayOptions options = { .stopWhenTouched = false };
    auto optionsOpt = Converter::ArkValue<Opt_AutoPlayOptions>(options);
    modifier_->setAutoPlay1(node_, &OPT_BOOL_TRUE, &optionsOpt);
    checkAutoPlay = GetAttrValue<std::string>(node_, propNameAutoPlay);
    EXPECT_THAT(checkAutoPlay, Eq(EXPECTED_TRUE));
    checkAutoPlayOptions = GetAttrValue<std::string>(node_, propNameAutoPlayOptions);
    EXPECT_THAT(checkAutoPlayOptions, Eq(EXPECTED_FALSE));

    options = { .stopWhenTouched = true };
    optionsOpt = Converter::ArkValue<Opt_AutoPlayOptions>(options);
    modifier_->setAutoPlay1(node_, &OPT_BOOL_FALSE, &optionsOpt);
    checkAutoPlay = GetAttrValue<std::string>(node_, propNameAutoPlay);
    EXPECT_THAT(checkAutoPlay, Eq(EXPECTED_FALSE));
    checkAutoPlayOptions = GetAttrValue<std::string>(node_, propNameAutoPlayOptions);
    EXPECT_THAT(checkAutoPlayOptions, Eq(EXPECTED_TRUE));
}
/**
 * @tc.name: setIntervalTest
 * @tc.desc: Check the functionality of SwiperModifier.IntervalImpl
 * @tc.type: FUNC
 */
HWTEST_F(SwiperModifierTest, DISABLED_setIntervalTest, TestSize.Level1)
{
    constexpr auto propName = "interval";
    const std::string defaultValue(std::to_string(static_cast<int>(DEFAULT_SWIPER_AUTOPLAY_INTERVAL)));
    ASSERT_NE(modifier_->setInterval, nullptr);

    auto checkInitial = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkInitial, Eq(defaultValue));

    auto numberInt = ArkValue<Opt_Int32>(123456);
    modifier_->setInterval(node_, &numberInt);
    auto checkVal2 = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkVal2, Eq("123456"));

    auto numberFlt = ArkValue<Opt_Int32>(0);
    modifier_->setInterval(node_, &numberFlt);
    auto checkVal3 = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkVal3, Eq("0"));

    auto numberIntNeg = ArkValue<Opt_Int32>(-1);
    modifier_->setInterval(node_, &numberIntNeg);
    auto checkVal4 = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkVal4, Eq(defaultValue));
}

/**
 * @tc.name: setIndicatorTestBoolean
 * @tc.desc: Check the functionality of SwiperModifier.IndicatorImpl with Boolean type
 * @tc.type: FUNC
 */
HWTEST_F(SwiperModifierTest, setIndicatorTestBoolean, TestSize.Level1)
{
    constexpr auto propName = "indicator";
    ASSERT_NE(modifier_->setIndicator, nullptr);

    auto checkInitial = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkInitial, Eq(EXPECTED_TRUE));

    auto boolIndFalse = ArkUnion<Opt_Union_IndicatorComponentController_DotIndicator_DigitIndicator_Boolean,
        Ark_Boolean>(ABOOL_FALSE);
    modifier_->setIndicator(node_, &boolIndFalse);
    auto checkFalse = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkFalse, Eq(EXPECTED_FALSE));

    auto boolIndTrue = ArkUnion<Opt_Union_IndicatorComponentController_DotIndicator_DigitIndicator_Boolean,
        Ark_Boolean>(ABOOL_TRUE);
    modifier_->setIndicator(node_, &boolIndTrue);
    auto checkTrue = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkTrue, Eq(EXPECTED_TRUE));
}

/**
 * @tc.name: setDisplayArrowTestStyleShowBg
 * @tc.desc: Check the functionality of SwiperModifier.setDisplayArrow with the Style size subattruibutes
 * @tc.type: FUNC
 */
HWTEST_F(SwiperModifierTest, setDisplayArrowTestStyleShowBg, TestSize.Level1)
{
    constexpr auto propName = "showBackground";
    const std::string defaultValue = EXPECTED_FALSE;

    ASSERT_NE(modifier_->setDisplayArrow, nullptr);

    auto checkValInitial = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkValInitial, Eq(defaultValue));

    Ark_Union_ArrowStyle_Boolean arkParam1 = {.selector=0, .value0={.showBackground = OPT_BOOL_TRUE}};
    auto optParam = Converter::ArkValue<Opt_Union_ArrowStyle_Boolean>(arkParam1);
    modifier_->setDisplayArrow(node_, &optParam, nullptr);
    auto checkInitial = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkInitial, Eq(EXPECTED_TRUE));

    Ark_Union_ArrowStyle_Boolean arkParam2 = {.selector=0, .value0={.showBackground = OPT_BOOL_FALSE}};
    optParam = Converter::ArkValue<Opt_Union_ArrowStyle_Boolean>(arkParam2);
    modifier_->setDisplayArrow(node_, &optParam, nullptr);
    auto checkVal2 = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkVal2, Eq(EXPECTED_FALSE));

    Ark_Union_ArrowStyle_Boolean arkParam3 = {.selector=0, .value0={.showBackground = OPT_BOOL_UNDEF}};
    optParam = Converter::ArkValue<Opt_Union_ArrowStyle_Boolean>(arkParam3);
    modifier_->setDisplayArrow(node_, &optParam, nullptr);
    auto checkVal3 = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkVal3, Eq(defaultValue));
}

/**
 * @tc.name: setDisplayArrowTestStyleSize
 * @tc.desc: Check the functionality of SwiperModifier.setDisplayArrow with the Style size subattruibutes
 * @tc.type: FUNC
 */
HWTEST_F(SwiperModifierTest, DISABLED_setDisplayArrowTestStyleSize, TestSize.Level1)
{
    typedef std::tuple<Ark_ArrowStyle, std::string> OneTestStep;
    constexpr auto propName = "arrowSize";
    const std::string &defaultValueS(EXPECTED_VP_ZERO);
    const std::string &defaultValueB(EXPECTED_VP_ZERO);
    const std::vector<OneTestStep> testPlan = {
        { {.isSidebarMiddle = OPT_BOOL_FALSE, .arrowSize = OPT_LEN_VP_POS}, "1.23vp" },
        { {.isSidebarMiddle = OPT_BOOL_FALSE, .arrowSize = OPT_LEN_VP_NEG}, defaultValueS },
        { {.isSidebarMiddle = OPT_BOOL_FALSE, .arrowSize = OPT_LEN_UNDEF}, defaultValueS },
        { {.isSidebarMiddle = OPT_BOOL_TRUE, .arrowSize = OPT_LEN_VP_POS}, "1.23vp" },
        { {.isSidebarMiddle = OPT_BOOL_TRUE, .arrowSize = OPT_LEN_VP_NEG}, defaultValueB },
        { {.isSidebarMiddle = OPT_BOOL_TRUE, .arrowSize = OPT_LEN_UNDEF}, defaultValueB },
        { {.isSidebarMiddle = OPT_BOOL_UNDEF, .arrowSize = OPT_LEN_VP_POS}, "1.23vp" },
        { {.isSidebarMiddle = OPT_BOOL_UNDEF, .arrowSize = OPT_LEN_VP_NEG}, defaultValueS },
        { {.isSidebarMiddle = OPT_BOOL_UNDEF, .arrowSize = OPT_LEN_UNDEF}, defaultValueS },
    };

    ASSERT_NE(modifier_->setDisplayArrow, nullptr);

    auto checkInitial = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkInitial, Eq("0.00vp"));

    for (const auto &[style, expect]: testPlan) {
        Ark_Union_ArrowStyle_Boolean arkParam = {
            .selector = 0, .value0 = style
        };
        auto optParam = Converter::ArkValue<Opt_Union_ArrowStyle_Boolean>(arkParam);
        modifier_->setDisplayArrow(node_, &optParam, nullptr);
        auto checkVal2 = GetAttrValue<std::string>(node_, propName);
        EXPECT_THAT(checkVal2, Eq(expect));
        auto checkVal3 = GetAttrValue<std::string>(node_, "isSidebarMiddle");
        auto optExp3 = Converter::OptConvert<bool>(style.isSidebarMiddle);
        bool expect3 = optExp3 && *optExp3;
        EXPECT_THAT(checkVal3, Eq(expect3 ? EXPECTED_TRUE : EXPECTED_FALSE));
    }
}

/**
 * @tc.name: setDisplayArrowTestStyleBgSize
 * @tc.desc: Check the functionality of SwiperModifier.setDisplayArrow with the Style, bg size subattruibutes
 * @tc.type: FUNC
 */
HWTEST_F(SwiperModifierTest, DISABLED_setDisplayArrowTestStyleBgSize, TestSize.Level1)
{
    typedef std::tuple<Ark_ArrowStyle, std::string> OneTestStep;
    constexpr auto propName = "arrowBackgroundSize";
    const std::string &defaultValueS(EXPECTED_VP_ZERO);
    const std::string &defaultValueB(EXPECTED_VP_ZERO);
    const std::vector<OneTestStep> testPlan = {
        { {.isSidebarMiddle = OPT_BOOL_FALSE, .backgroundSize = OPT_LEN_VP_POS}, "1.23vp" },
        { {.isSidebarMiddle = OPT_BOOL_FALSE, .backgroundSize = OPT_LEN_VP_NEG}, defaultValueS },
        { {.isSidebarMiddle = OPT_BOOL_FALSE, .backgroundSize = OPT_LEN_UNDEF}, defaultValueS },
        { {.isSidebarMiddle = OPT_BOOL_TRUE, .backgroundSize = OPT_LEN_VP_POS}, "1.23vp" },
        { {.isSidebarMiddle = OPT_BOOL_TRUE, .backgroundSize = OPT_LEN_VP_NEG}, defaultValueB },
        { {.isSidebarMiddle = OPT_BOOL_TRUE, .backgroundSize = OPT_LEN_UNDEF}, defaultValueB },
        { {.isSidebarMiddle = OPT_BOOL_UNDEF, .backgroundSize = OPT_LEN_VP_POS}, "1.23vp" },
        { {.isSidebarMiddle = OPT_BOOL_UNDEF, .backgroundSize = OPT_LEN_VP_NEG}, defaultValueS },
        { {.isSidebarMiddle = OPT_BOOL_UNDEF, .backgroundSize = OPT_LEN_UNDEF}, defaultValueS },
    };

    ASSERT_NE(modifier_->setDisplayArrow, nullptr);

    auto checkInitial = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkInitial, Eq("0.00vp"));

    for (const auto &[style, expect]: testPlan) {
        Ark_Union_ArrowStyle_Boolean arkParam = {
            .selector = 0, .value0 = style
        };
        auto optParam = Converter::ArkValue<Opt_Union_ArrowStyle_Boolean>(arkParam);
        modifier_->setDisplayArrow(node_, &optParam, nullptr);
        auto checkVal2 = GetAttrValue<std::string>(node_, propName);
        EXPECT_THAT(checkVal2, Eq(expect));
    }
}

/**
 * @tc.name: setDisplayArrowTestStyleColorDefault
 * @tc.desc: Check the functionality of SwiperModifier.DisplayArrowImpl with Style, the Color's default and init
 * @tc.type: FUNC
 */
HWTEST_F(SwiperModifierTest, DISABLED_setDisplayArrowTestStyleColorDefault, TestSize.Level1)
{
    const std::string defaultValue = Color::TRANSPARENT.ToString();
    {
        auto initArrowColor = GetAttrValue<std::string>(node_, "arrowColor");
        EXPECT_THAT(initArrowColor, Eq(Color::TRANSPARENT.ToString()));
        auto initArrowBgColor = GetAttrValue<std::string>(node_, "arrowBackgroundColor");
        EXPECT_THAT(initArrowBgColor, Eq(Color::TRANSPARENT.ToString()));
    }
    {
        Ark_Union_ArrowStyle_Boolean arkParam = { .selector = 0, .value0 = {
            .isSidebarMiddle = OPT_BOOL_FALSE,
            .arrowColor = OPT_COLOR_UNDEF,
            .backgroundColor = OPT_COLOR_UNDEF,
        } };
        auto optParam = Converter::ArkValue<Opt_Union_ArrowStyle_Boolean>(arkParam);
        modifier_->setDisplayArrow(node_, &optParam, nullptr);
        auto defaultSmallArrowColor = GetAttrValue<std::string>(node_, "arrowColor");
        EXPECT_THAT(defaultSmallArrowColor, Eq(defaultValue));
        auto defaultSmallArrowBgColor = GetAttrValue<std::string>(node_, "arrowBackgroundColor");
        EXPECT_THAT(defaultSmallArrowBgColor, Eq(Color::TRANSPARENT.ToString()));
    }
    {
        Ark_Union_ArrowStyle_Boolean arkParam = { .selector = 0, .value0 = {
            .isSidebarMiddle = OPT_BOOL_TRUE,
            .arrowColor = OPT_COLOR_UNDEF,
            .backgroundColor = OPT_COLOR_UNDEF,
        } };
        auto optParam = Converter::ArkValue<Opt_Union_ArrowStyle_Boolean>(arkParam);
        modifier_->setDisplayArrow(node_, &optParam, nullptr);
        auto defaultBigArrowColor = GetAttrValue<std::string>(node_, "arrowColor");
        EXPECT_THAT(defaultBigArrowColor, Eq(defaultValue));
        auto defaultBigArrowBgColor = GetAttrValue<std::string>(node_, "arrowBackgroundColor");
        EXPECT_THAT(defaultBigArrowBgColor, Eq(defaultValue));
    }
}

/**
 * @tc.name: setDisplayArrowTestStyleColor
 * @tc.desc: Check the functionality of SwiperModifier.DisplayArrowImpl with Style, the Color's subattributes
 * @tc.type: FUNC
 */
HWTEST_F(SwiperModifierTest, DISABLED_setDisplayArrowTestStyleColor, TestSize.Level1)
{
    typedef std::pair<Ark_ResourceColor, std::string> OneTestStep;
    const std::string expectedResourceColor = Color::RED.ToString();
    const std::vector<OneTestStep> testPlan = {
        { ArkUnion<Ark_ResourceColor, Ark_Color>(ARK_COLOR_WHITE), "#FFFFFFFF" },
        { ArkUnion<Ark_ResourceColor, Ark_Int32>(0x123456), "#FF123456" },
        { ArkUnion<Ark_ResourceColor, Ark_Int32>(0.5f), "#00000000" },
        { ArkUnion<Ark_ResourceColor, Ark_String>("#11223344"), "#11223344" },
        { ArkUnion<Ark_ResourceColor, Ark_String>("65535"), "#FF00FFFF" },
        { CreateResourceUnion<Ark_ResourceColor>(RES_NAME), expectedResourceColor },
        { CreateResourceUnion<Ark_ResourceColor>(RES_ID), expectedResourceColor },
    };

    ASSERT_NE(modifier_->setDisplayArrow, nullptr);

    for (const auto &[arkResColor, expected]: testPlan) {
        Ark_ArrowStyle style = {
             .arrowColor = ArkValue<Opt_ResourceColor>(arkResColor),
             .backgroundColor = ArkValue<Opt_ResourceColor>(arkResColor)
        };
        auto arkParam = ArkUnion<Opt_Union_ArrowStyle_Boolean, Ark_ArrowStyle>(style);
        modifier_->setDisplayArrow(node_, &arkParam, nullptr);
        auto checkColor = GetAttrValue<std::string>(node_, "arrowColor");
        EXPECT_THAT(checkColor, Eq(expected));
        auto checkBgColor = GetAttrValue<std::string>(node_, "arrowBackgroundColor");
        EXPECT_THAT(checkBgColor, Eq(expected));
    }
}

/**
 * @tc.name: setDisplayArrowTestBoolean
 * @tc.desc: Check the functionality of SwiperModifier.setDisplayArrow with Boolean type
 * @tc.type: FUNC
 */
HWTEST_F(SwiperModifierTest, setDisplayArrowTestBoolean, TestSize.Level1)
{
    constexpr auto propName = "displayArrow";
    constexpr auto propNameExt = "hoverShow";
    ASSERT_NE(modifier_->setDisplayArrow, nullptr);

    auto isDisplayArrowDefault = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(isDisplayArrowDefault, Eq(EXPECTED_FALSE));
    auto isHoverShowDefault = GetAttrValue<std::string>(node_, propNameExt);
    EXPECT_THAT(isHoverShowDefault, Eq(EXPECTED_FALSE));

    auto boolFalse = ArkUnion<Opt_Union_ArrowStyle_Boolean, Ark_Boolean>(ABOOL_FALSE);
    modifier_->setDisplayArrow(node_, &boolFalse, nullptr);
    auto checkVal2 = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkVal2, Eq(EXPECTED_FALSE));
    auto checkVal2x = GetAttrValue<std::string>(node_, propNameExt);
    EXPECT_THAT(checkVal2x, Eq(EXPECTED_FALSE));

    auto boolIndTrue = ArkUnion<Opt_Union_ArrowStyle_Boolean, Ark_Boolean>(ABOOL_TRUE);
    modifier_->setDisplayArrow(node_, &boolIndTrue, nullptr);
    auto checkVal3 = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkVal3, Eq(EXPECTED_TRUE));
    auto checkVal3x = GetAttrValue<std::string>(node_, propNameExt);
    EXPECT_THAT(checkVal3x, Eq(EXPECTED_FALSE));

    modifier_->setDisplayArrow(node_, &boolIndTrue, &OPT_BOOL_TRUE);
    auto checkVal4x = GetAttrValue<std::string>(node_, propNameExt);
    EXPECT_THAT(checkVal4x, Eq(EXPECTED_TRUE));

    modifier_->setDisplayArrow(node_, &boolIndTrue, &OPT_BOOL_UNDEF);
    auto checkVal5x = GetAttrValue<std::string>(node_, propNameExt);
    EXPECT_THAT(checkVal5x, Eq(EXPECTED_FALSE));

    modifier_->setDisplayArrow(node_, &boolIndTrue, &OPT_BOOL_FALSE);
    auto checkVal6x = GetAttrValue<std::string>(node_, propNameExt);
    EXPECT_THAT(checkVal6x, Eq(EXPECTED_FALSE));

    modifier_->setDisplayArrow(node_, &boolIndTrue, &OPT_BOOL_UNDEF);
    auto checkVal7x = GetAttrValue<std::string>(node_, propNameExt);
    EXPECT_THAT(checkVal7x, Eq(EXPECTED_FALSE));
}
/**
 * @tc.name: setLoopTest
 * @tc.desc: Check the functionality of SwiperModifier.LoopImpl
 * @tc.type: FUNC
 */
HWTEST_F(SwiperModifierTest, setLoopTest, TestSize.Level1)
{
    constexpr auto propName = "loop";
    const std::string &defaultValue(EXPECTED_TRUE);
    ASSERT_NE(modifier_->setLoop, nullptr);

    auto checkInitial = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkInitial, Eq(defaultValue));

    modifier_->setLoop(node_, &OPT_BOOL_TRUE);
    auto checkTrue = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkTrue, Eq(EXPECTED_TRUE));

    modifier_->setLoop(node_, &OPT_BOOL_FALSE);
    auto checkFalse = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkFalse, Eq(EXPECTED_FALSE));
}
/**
 * @tc.name: setDurationTest
 * @tc.desc: Check the functionality of SwiperModifier.DurationImpl
 * @tc.type: FUNC
 */
HWTEST_F(SwiperModifierTest, DISABLED_setDurationTest, TestSize.Level1)
{
    constexpr auto propName = "duration";
    const std::string defaultValue(std::to_string(static_cast<int32_t>(DEFAULT_SWIPER_ANIMATION_DURATION)));
    ASSERT_NE(modifier_->setDuration, nullptr);

    auto checkInitial = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkInitial, Eq(defaultValue));

    auto numberInt = ArkValue<Opt_Int32>(123456);
    modifier_->setDuration(node_, &numberInt);
    auto checkVal2 = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkVal2, Eq("123456"));

    auto numberFlt = ArkValue<Opt_Int32>(1);
    modifier_->setDuration(node_, &numberFlt);
    auto checkVal3 = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkVal3, Eq("1"));

    auto numberIntNeg = ArkValue<Opt_Int32>(-1);
    modifier_->setDuration(node_, &numberIntNeg);
    auto checkVal4 = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkVal4, Eq(defaultValue));
}
/**
 * @tc.name: setVerticalTest
 * @tc.desc: Check the functionality of SwiperModifier.VerticalImpl
 * @tc.type: FUNC
 */
HWTEST_F(SwiperModifierTest, setVerticalTest, TestSize.Level1)
{
    constexpr auto propName = "vertical";
    const std::string defaultValue(EXPECTED_FALSE);
    ASSERT_NE(modifier_->setVertical, nullptr);

    auto checkInitial = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkInitial, Eq(defaultValue));

    modifier_->setVertical(node_, &OPT_BOOL_TRUE);
    auto checkVal2 = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkVal2, Eq(EXPECTED_TRUE));

    modifier_->setVertical(node_, &OPT_BOOL_FALSE);
    auto checkVal3 = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkVal3, Eq(EXPECTED_FALSE));
}
/**
 * @tc.name: setItemSpaceTest
 * @tc.desc: Check the functionality of SwiperModifier.ItemSpaceImpl
 * @tc.type: FUNC
 */
HWTEST_F(SwiperModifierTest, DISABLED_setItemSpaceTest, TestSize.Level1)
{
    using namespace Converter;
    using TypeArg0 = Opt_Union_F64_String;
    using OneTestStep = std::pair<TypeArg0, std::string>;
    constexpr auto propName = "itemSpace";
    const std::string &defaultValue(EXPECTED_VP_ZERO);
    const std::vector<OneTestStep> testPlan = {
        { ArkUnion<TypeArg0, Ark_Float64>(1234), "1234.00vp"},
        { ArkUnion<TypeArg0, Ark_Float64>(AINT32_NEG), defaultValue},
        { ArkUnion<TypeArg0, Ark_Float64>(1.234), "1.23vp"},
        { ArkUnion<TypeArg0, Ark_Float64>(AFLT32_NEG), defaultValue},
        { ArkUnion<TypeArg0, Ark_String>("7.89px"), "7.89px"},
        { ArkUnion<TypeArg0, Ark_String>("-4.5px"), defaultValue},
        { ArkUnion<TypeArg0, Ark_String>("1.2345vp"), "1.23vp"},
        { ArkUnion<TypeArg0, Ark_String>("-56vp"), defaultValue},
    };

    ASSERT_NE(modifier_->setItemSpace, nullptr);

    auto checkInitial = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkInitial, Eq(defaultValue));

    for (const auto &[itemSpace, expected]: testPlan) {
        modifier_->setItemSpace(node_, &itemSpace);
        auto checkVal = GetAttrValue<std::string>(node_, propName);
        EXPECT_THAT(checkVal, Eq(expected));
    }
}
/**
 * @tc.name: setDisplayModeTest
 * @tc.desc: Check the functionality of SwiperModifier.DisplayModeImpl
 * @tc.type: FUNC
 */
HWTEST_F(SwiperModifierTest, DISABLED_setDisplayModeTest, TestSize.Level1)
{
    constexpr auto propName = "displayMode";
    constexpr auto defaultValue = "SwiperDisplayMode.Stretch"; // corrrsponds to
    // SwiperDisplayMode::STRETCH in frameworks/core/components/declaration/swiper/swiper_declaration.h
    ASSERT_NE(modifier_->setDisplayMode, nullptr);

    auto checkInitial = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkInitial, Eq(defaultValue));

    auto mode = Converter::ArkValue<Opt_SwiperDisplayMode>(ARK_SWIPER_DISPLAY_MODE_STRETCH);
    modifier_->setDisplayMode(node_, &mode);
    auto checkVal2 = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkVal2, Eq("SwiperDisplayMode.Stretch"));

    auto arkValue2 = static_cast<Ark_SwiperDisplayMode>(INT_MAX);
    mode = Converter::ArkValue<Opt_SwiperDisplayMode>(arkValue2);
    modifier_->setDisplayMode(node_, &mode);
    auto checkVal4 = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkVal2, Eq("SwiperDisplayMode.Stretch"));

    auto arkValue3 = static_cast<Ark_SwiperDisplayMode>(INT_MIN);
    mode = Converter::ArkValue<Opt_SwiperDisplayMode>(arkValue3);
    modifier_->setDisplayMode(node_, &mode);
    auto checkVal5 = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkVal2, Eq("SwiperDisplayMode.Stretch"));
}
/**
 * @tc.name: setCachedCount0Test
 * @tc.desc: Check the functionality of SwiperModifier.CachedCountImpl
 * @tc.type: FUNC
 */
HWTEST_F(SwiperModifierTest, DISABLED_setCachedCount0Test, TestSize.Level1)
{
    constexpr auto propName = "cachedCount";
    const int defaultValue(DEFAULT_SWIPER_CACHED_SIZE);
    ASSERT_NE(modifier_->setCachedCount0, nullptr);

    auto checkInitial = GetAttrValue<int>(node_, propName);
    EXPECT_THAT(checkInitial, Eq(defaultValue));

    auto numberInt = ArkValue<Opt_Int32>(123456);
    modifier_->setCachedCount0(node_, &numberInt);
    auto checkVal2 = GetAttrValue<int>(node_, propName);
    EXPECT_THAT(checkVal2, Eq(123456));

    auto numberFlt = ArkValue<Opt_Int32>(1);
    modifier_->setCachedCount0(node_, &numberFlt);
    auto checkVal3 = GetAttrValue<int>(node_, propName);
    EXPECT_THAT(checkVal3, Eq(1));

    auto numberIntNeg = ArkValue<Opt_Int32>(-111);
    modifier_->setCachedCount0(node_, &numberIntNeg);
    auto checkVal4 = GetAttrValue<int>(node_, propName);
    EXPECT_THAT(checkVal4, Eq(defaultValue));
}

/**
 * @tc.name: setCachedCount1Test
 * @tc.desc: Check the functionality of SwiperModifier.CachedCount1Impl
 * @tc.type: FUNC
 */
HWTEST_F(SwiperModifierTest, DISABLED_setCachedCount1Test, TestSize.Level1)
{
    const std::string propNameCount("cachedCount");
    const int defaultValueCount(DEFAULT_SWIPER_CACHED_SIZE);
    const std::string propNameShown("cachedIsShown");
    const std::string &defaultValueShown(EXPECTED_FALSE);
    ASSERT_NE(modifier_->setCachedCount1, nullptr);

    auto checkCount = GetAttrValue<int>(node_, propNameCount);
    EXPECT_THAT(checkCount, Eq(defaultValueCount));
    auto checkShown = GetAttrValue<std::string>(node_, propNameShown);
    EXPECT_THAT(checkShown, Eq(defaultValueShown));

    auto numberInt = ArkValue<Opt_Int32>(123456);
    auto isShown = ArkValue<Opt_Boolean>(true);
    modifier_->setCachedCount1(node_, &numberInt, &isShown);
    checkCount = GetAttrValue<int>(node_, propNameCount);
    EXPECT_THAT(checkCount, Eq(123456));
    checkShown = GetAttrValue<std::string>(node_, propNameShown);
    EXPECT_THAT(checkShown, Eq(EXPECTED_TRUE));

    auto numberFlt = ArkValue<Opt_Int32>(1);
    isShown = ArkValue<Opt_Boolean>(false);
    modifier_->setCachedCount1(node_, &numberFlt, &isShown);
    checkCount = GetAttrValue<int>(node_, propNameCount);
    EXPECT_THAT(checkCount, Eq(1));
    checkShown = GetAttrValue<std::string>(node_, propNameShown);
    EXPECT_THAT(checkShown, Eq(EXPECTED_FALSE));

    auto numberIntNeg = ArkValue<Opt_Int32>(-111);
    isShown = ArkValue<Opt_Boolean>(true);
    modifier_->setCachedCount1(node_, &numberIntNeg, &isShown);
    checkCount = GetAttrValue<int>(node_, propNameCount);
    EXPECT_THAT(checkCount, Eq(defaultValueCount));
    checkShown = GetAttrValue<std::string>(node_, propNameShown);
    EXPECT_THAT(checkShown, Eq(EXPECTED_TRUE));

    auto numberFltNeg = ArkValue<Opt_Int32>(-1);
    isShown = ArkValue<Opt_Boolean>(false);
    modifier_->setCachedCount1(node_, &numberFltNeg, &isShown);
    checkCount = GetAttrValue<int>(node_, propNameCount);
    EXPECT_THAT(checkCount, Eq(defaultValueCount));
    checkShown = GetAttrValue<std::string>(node_, propNameShown);
    EXPECT_THAT(checkShown, Eq(EXPECTED_FALSE));
}
/**
 * @tc.name: setDisplayCountTestNumber
 * @tc.desc: Check the functionality of SwiperModifier.DisplayCountImpl with Ark_Number arg
 * @tc.type: FUNC
 */
HWTEST_F(SwiperModifierTest, setDisplayCountTestNumber, TestSize.Level1)
{
    constexpr auto propName = "displayCount";
    const int defaultValue(DEFAULT_SWIPER_DISPLAY_COUNT);
    ASSERT_NE(modifier_->setDisplayCount, nullptr);

    auto checkInitial = GetAttrValue<int>(node_, propName);
    EXPECT_THAT(checkInitial, Eq(defaultValue));

    auto numberInt = ArkUnion<Opt_Union_I32_String_SwiperAutoFill_ItemFillPolicy, Ark_Int32>(123456);
    modifier_->setDisplayCount(node_, &numberInt, nullptr);
    auto checkVal2 = GetAttrValue<int>(node_, propName);
    EXPECT_THAT(checkVal2, Eq(123456));

    auto numberFlt = ArkUnion<Opt_Union_I32_String_SwiperAutoFill_ItemFillPolicy, Ark_Int32>(1);
    modifier_->setDisplayCount(node_, &numberFlt, nullptr);
    auto checkVal3 = GetAttrValue<int>(node_, propName);
    EXPECT_THAT(checkVal3, Eq(1));

    auto numberIntNeg = ArkUnion<Opt_Union_I32_String_SwiperAutoFill_ItemFillPolicy, Ark_Int32>(-111);
    modifier_->setDisplayCount(node_, &numberIntNeg, nullptr);
    auto checkVal4 = GetAttrValue<int>(node_, propName);
    EXPECT_THAT(checkVal4, Eq(defaultValue));

    auto numberFltNeg = ArkUnion<Opt_Union_I32_String_SwiperAutoFill_ItemFillPolicy, Ark_Int32>(-1);
    modifier_->setDisplayCount(node_, &numberFltNeg, nullptr);

    auto checkVal5 = GetAttrValue<int>(node_, propName);
    EXPECT_THAT(checkVal5, Eq(defaultValue));
}
/**
 * @tc.name: setDisplayCountTestString
 * @tc.desc: Check the functionality of SwiperModifier.DisplayCountImpl with Ark_String arg
 * @tc.type: FUNC
 */
HWTEST_F(SwiperModifierTest, setDisplayCountTestString, TestSize.Level1)
{
    constexpr auto propName = "displayCount";
    ASSERT_NE(modifier_->setDisplayCount, nullptr);

    auto checkInitial = GetAttrValue<int>(node_, propName);
    EXPECT_THAT(checkInitial, Eq(DEFAULT_SWIPER_DISPLAY_COUNT));

    auto regularVal = ArkUnion<Opt_Union_I32_String_SwiperAutoFill_ItemFillPolicy, Ark_String>("1234");
    modifier_->setDisplayCount(node_, &regularVal, nullptr);
    auto checkVal2 = GetAttrValue<int>(node_, propName);
    EXPECT_THAT(checkVal2, Eq(DEFAULT_SWIPER_DISPLAY_COUNT));

    auto arkValue0 = ArkValue<Opt_SwiperDisplayMode>(ARK_SWIPER_DISPLAY_MODE_STRETCH);
    modifier_->setDisplayMode(node_, &arkValue0);
    auto autoVal = ArkUnion<Opt_Union_I32_String_SwiperAutoFill_ItemFillPolicy, Ark_String>("auto");
    modifier_->setDisplayCount(node_, &autoVal, nullptr);
    auto checkVal3 = GetAttrValue<int>(node_, propName);
    EXPECT_THAT(checkVal3, Eq(DEFAULT_SWIPER_DISPLAY_COUNT));
    auto checkValDispMode= GetAttrValue<std::string>(node_, "displayMode");
    EXPECT_THAT(checkValDispMode, Eq("SwiperDisplayMode.AutoLinear"));

    auto negVal = ArkUnion<Opt_Union_I32_String_SwiperAutoFill_ItemFillPolicy, Ark_String>("-1234");
    modifier_->setDisplayCount(node_, &negVal, nullptr);
    auto checkVal4 = GetAttrValue<int>(node_, propName);
    EXPECT_THAT(checkVal4, Eq(DEFAULT_SWIPER_DISPLAY_COUNT));
}

/**
 * @tc.name: setDisplayCountTestObj
 * @tc.desc: Check the functionality of SwiperModifier.DisplayCountImpl with Ark_VP object argument
 * @tc.type: FUNC
 */
HWTEST_F(SwiperModifierTest, DISABLED_setDisplayCountTestObj, TestSize.Level1)
{
    typedef Opt_Union_I32_String_SwiperAutoFill_ItemFillPolicy displayCountArgT;
    typedef Ark_SwiperAutoFill checkT;
    constexpr auto propName = "minSize";
    const std::string &defaultValue(EXPECTED_VP_ZERO);
    ASSERT_NE(modifier_->setDisplayCount, nullptr);

    auto checkInitial = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkInitial, Eq(defaultValue));

    auto intVal = ArkUnion<displayCountArgT, checkT>(ArkValue<checkT>(ArkUnion<Ark_VP, Ark_Float64>(123)));
    modifier_->setDisplayCount(node_, &intVal, nullptr);
    auto checkInt = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkInt, Eq("123.00vp"));

    auto floatVal = ArkUnion<displayCountArgT, checkT>(ArkValue<checkT>(ArkUnion<Ark_VP, Ark_Float64>(1.23f)));
    modifier_->setDisplayCount(node_, &floatVal, nullptr);
    auto checkFloat = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkFloat, Eq("1.23vp"));

    auto strPx = ArkUnion<displayCountArgT, checkT>(ArkValue<checkT>(ArkUnion<Ark_VP, Ark_String>("45px")));
    modifier_->setDisplayCount(node_, &strPx, nullptr);
    auto checkStrPx = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkStrPx, Eq("45.00px"));

    auto strVp = ArkUnion<displayCountArgT, checkT>(ArkValue<checkT>(ArkUnion<Ark_VP, Ark_String>("5.60vp")));
    modifier_->setDisplayCount(node_, &strVp, nullptr);
    auto checkStrVp = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkStrVp, Eq("5.60vp"));

    auto intNegVal = ArkUnion<displayCountArgT, checkT>(ArkValue<checkT>(ArkUnion<Ark_VP, Ark_Float64>(-123)));
    modifier_->setDisplayCount(node_, &intNegVal, nullptr);
    auto checkIntNeg = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkIntNeg, Eq(defaultValue));

    auto floatNegVal = ArkUnion<displayCountArgT, checkT>(ArkValue<checkT>(ArkUnion<Ark_VP, Ark_Float64>(-1.23f)));
    modifier_->setDisplayCount(node_, &floatNegVal, nullptr);
    auto checkFloatNeg = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkFloatNeg, Eq(defaultValue));

    auto strPxNeg = ArkUnion<displayCountArgT, checkT>(ArkValue<checkT>(ArkUnion<Ark_VP, Ark_String>("-4.5px")));
    modifier_->setDisplayCount(node_, &strPxNeg, nullptr);
    auto checkStrPxNeg = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkStrPxNeg, Eq(defaultValue));

    auto strVpNeg = ArkUnion<displayCountArgT, checkT>(ArkValue<checkT>(ArkUnion<Ark_VP, Ark_String>("-56vp")));
    modifier_->setDisplayCount(node_, &strVpNeg, nullptr);
    auto checkStrVpNeg = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkStrVpNeg, Eq(defaultValue));
}

/**
 * @tc.name: setDisplayCountTestByGroup
 * @tc.desc: Check the functionality of SwiperModifier.DisplayCountImpl with ByGroup optional
 * @tc.type: FUNC
 */
HWTEST_F(SwiperModifierTest, setDisplayCountTestByGroup, TestSize.Level1)
{
    constexpr auto propName = "swipeByGroup";
    const std::string defaultValue(EXPECTED_FALSE);
    ASSERT_NE(modifier_->setDisplayCount, nullptr);

    Opt_Union_I32_String_SwiperAutoFill_ItemFillPolicy aceFakeArg0;

    auto checkInitial = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkInitial, Eq(defaultValue));

    modifier_->setDisplayCount(node_, &aceFakeArg0, &OPT_BOOL_TRUE);
    auto checkVal2 = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkVal2, Eq(EXPECTED_TRUE));

    modifier_->setDisplayCount(node_, &aceFakeArg0, nullptr);
    auto checkVal2opt = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkVal2opt, Eq(EXPECTED_TRUE)); // nothing change if no optional arg

    modifier_->setDisplayCount(node_, &aceFakeArg0, &OPT_BOOL_FALSE);
    auto checkVal3 = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkVal3, Eq(EXPECTED_FALSE));

    modifier_->setDisplayCount(node_, &aceFakeArg0, nullptr);
    auto checkVal3opt = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkVal3opt, Eq(EXPECTED_FALSE)); // nothing change if no optional arg
}

/**
 * @tc.name: setEffectModeTest
 * @tc.desc: Check the functionality of SwiperModifier.EffectModeImpl
 * @tc.type: FUNC
 */
HWTEST_F(SwiperModifierTest, DISABLED_setEffectModeTest, TestSize.Level1)
{
    constexpr auto propName = "effectMode";
    constexpr auto defaultValue = "EdgeEffect.Spring";
    auto checkInitial = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkInitial, Eq(defaultValue));

    auto effect = Converter::ArkValue<Opt_EdgeEffect>(ARK_EDGE_EFFECT_SPRING);
    modifier_->setEffectMode(node_, &effect);
    auto checkVal2 = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkVal2, Eq("EdgeEffect.Spring"));

    effect = Converter::ArkValue<Opt_EdgeEffect>(ARK_EDGE_EFFECT_FADE);
    modifier_->setEffectMode(node_, &effect);
    auto checkVal3 = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkVal3, Eq("EdgeEffect.Fade"));
    auto arkValue2 = static_cast<Ark_EdgeEffect>(INT_MAX);
    effect = Converter::ArkValue<Opt_EdgeEffect>(arkValue2);
    modifier_->setEffectMode(node_, &effect);
    auto checkVal4 = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkVal4, Eq(defaultValue));
    auto arkValue3 = static_cast<Ark_EdgeEffect>(INT_MIN);
    effect = Converter::ArkValue<Opt_EdgeEffect>(arkValue3);
    modifier_->setEffectMode(node_, &effect);
    auto checkVal5 = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkVal5, Eq(defaultValue));
}
/**
 * @tc.name: setDisableSwipeTest
 * @tc.desc: Check the functionality of SwiperModifier.DisableSwipeImpl
 * @tc.type: FUNC
 */
HWTEST_F(SwiperModifierTest, setDisableSwipeTest, TestSize.Level1)
{
    constexpr auto propName = "disableSwipe";
    const std::string defaultValue(EXPECTED_FALSE);
    ASSERT_NE(modifier_->setDisableSwipe, nullptr);

    auto checkInitial = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkInitial, Eq(defaultValue));

    modifier_->setDisableSwipe(node_, &OPT_BOOL_TRUE);
    auto checkVal2 = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkVal2, Eq(EXPECTED_TRUE));

    modifier_->setDisableSwipe(node_, &OPT_BOOL_FALSE);
    auto checkVal3 = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkVal3, Eq(EXPECTED_FALSE));
}
/**
 * @tc.name: setCurveTestBuiltIn
 * @tc.desc: Check the functionality of SwiperModifier.CurveImpl for built-in curves
 * @tc.type: FUNC
 */
HWTEST_F(SwiperModifierTest, DISABLED_setCurveTestBuiltIn, TestSize.Level1)
{
    constexpr auto propName = "curve";
    const std::string defaultValue(Curves::ToString(Curves::EASE_IN_OUT));
    ASSERT_NE(modifier_->setCurve, nullptr);

    auto checkInitial = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkInitial, Eq(Curves::DEFAULT_CURVE_NAME));

    auto arkCurveEasyIn =
        ArkUnion<Opt_Union_Curve_String_ICurve, Ark_curves_Curve>(ARK_CURVES_CURVE_EASE_IN);
    modifier_->setCurve(node_, &arkCurveEasyIn);
    auto checkEasyIO = GetAttrValue<std::string>(node_, propName);
    auto expectedCurveEasyIn =
        Framework::CreateCurve(Framework::CurveIntToString(ArkUI_AnimationCurve::ARKUI_CURVE_EASE_IN));
    EXPECT_THAT(checkEasyIO, Eq(Curves::ToString(expectedCurveEasyIn)));

    modifier_->setCurve(node_, nullptr);
    auto checkNull = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkNull, Eq(Curves::ToString(expectedCurveEasyIn)));

    auto arkCurveLinear =
        ArkUnion<Opt_Union_Curve_String_ICurve, Ark_curves_Curve>(ARK_CURVES_CURVE_LINEAR);
    modifier_->setCurve(node_, &arkCurveLinear);
    auto checkLinear = GetAttrValue<std::string>(node_, propName);
    auto expectedCurveLinear =
        Framework::CreateCurve(Framework::CurveIntToString(ArkUI_AnimationCurve::ARKUI_CURVE_LINEAR));
    EXPECT_THAT(checkLinear, Eq(Curves::ToString(expectedCurveLinear)));

    auto arkCurveInv = ArkUnion<Opt_Union_Curve_String_ICurve, Ark_curves_Curve>(INVALID_ENUM_VAL<Ark_curves_Curve>);
    modifier_->setCurve(node_, &arkCurveInv);
    auto checkInv = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkInv, Eq(defaultValue));
}
/**
 * @tc.name: setCurveTestCustom
 * @tc.desc: Check the functionality of SwiperModifier.CurveImpl for Custom curves
 * @tc.type: FUNC
 */
HWTEST_F(SwiperModifierTest, DISABLED_setCurveTestCustom, TestSize.Level1)
{
    constexpr auto propName = "curve";
    const std::string defaultValue(Curves::ToString(Curves::EASE_IN_OUT));
    ASSERT_NE(modifier_->setCurve, nullptr);

    auto checkInitial = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkInitial, Eq(Curves::DEFAULT_CURVE_NAME));

    auto arkCurveCustom = ArkUnion<Opt_Union_Curve_String_ICurve, Ark_String>("interpolating-spring(1, 1, 28, 34)");
    modifier_->setCurve(node_, &arkCurveCustom);
    auto checkCustStr = GetAttrValue<std::string>(node_, propName);
    // this can't be exactly check due to SwiperPaintProperty::ToJsonValue supports the built-in Curves only
    EXPECT_THAT(checkCustStr, Ne(defaultValue));

    auto arkCurveInv = ArkUnion<Opt_Union_Curve_String_ICurve, Ark_String>("invalidCurveDefinition");
    modifier_->setCurve(node_, &arkCurveInv);
    auto checkInv = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkInv, Eq(defaultValue));
}

/**
 * @tc.name: setOnChangeTest
 * @tc.desc: Check the functionality of SwiperModifier.OnChangeImpl
 * @tc.type: FUNC
 */
HWTEST_F(SwiperModifierTest, setOnChangeTest, TestSize.Level1)
{
    auto frameNode = reinterpret_cast<FrameNode*>(node_);
    ASSERT_NE(frameNode, nullptr);
    auto eventHub = frameNode->GetEventHub<NG::SwiperEventHub>();
    ASSERT_NE(eventHub, nullptr);

    struct CheckEvent {
        int32_t nodeId;
        int32_t index;
    };
    static std::optional<CheckEvent> checkEvent = std::nullopt;
    auto checkCallback =
        [](const Ark_Int32 resourceId, const Ark_Int32 index) {
            checkEvent = {
                .nodeId = resourceId,
                .index = Converter::Convert<Ark_Int32>(index)
            };
        };
    auto func = Converter::ArkValue<Callback_I32_Void>(checkCallback, CONTEXT_ID);
    auto optCallback = Converter::ArkValue<Opt_Callback_I32_Void>(func);

    ASSERT_NE(modifier_->setOnChange, nullptr);

    modifier_->setOnChange(node_, &optCallback);

    EXPECT_EQ(checkEvent.has_value(), false);
    eventHub->FireChangeEvent(0, 321, false);
    ASSERT_TRUE(checkEvent.has_value());
    EXPECT_EQ(checkEvent->nodeId, CONTEXT_ID);
    EXPECT_EQ(checkEvent->index, 321);
}

/**
 * @tc.name: setPrevMarginTest
 * @tc.desc: Check the functionality of SwiperModifier.PrevMarginImpl
 * @tc.type: FUNC
 */
HWTEST_F(SwiperModifierTest, DISABLED_setPrevMarginTest, TestSize.Level1)
{
    constexpr auto propName = "prevMargin";
    constexpr auto propNameOpt = "prevMarginIgnoreBlank";
    const std::string &defaultValue(EXPECTED_VP_ZERO);
    ASSERT_NE(modifier_->setPrevMargin, nullptr);

    // test init state
    auto checkInit = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkInit, Eq(defaultValue));
    auto checkInitOpt = GetAttrValue<std::string>(node_, propNameOpt);
    EXPECT_THAT(checkInitOpt, Eq(EXPECTED_FALSE));

    // test the main arg
    modifier_->setPrevMargin(node_, &OPT_LEN_VP_POS, nullptr);
    auto checkPxPos = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkPxPos, Eq(EXPECTED_VP_POS));
    modifier_->setPrevMargin(node_, &OPT_LEN_VP_NEG, nullptr);
    auto checkVpNeg = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkVpNeg, Eq(defaultValue));

    // test the optional arg
    modifier_->setPrevMargin(node_, &OPT_LEN_VP_POS, &OPT_BOOL_TRUE);
    auto checkOptTrue = GetAttrValue<std::string>(node_, propNameOpt);
    EXPECT_THAT(checkOptTrue, Eq(EXPECTED_TRUE));
    modifier_->setPrevMargin(node_, &OPT_LEN_VP_POS, &OPT_BOOL_UNDEF);
    auto checkOptUndef = GetAttrValue<std::string>(node_, propNameOpt);
    EXPECT_THAT(checkOptUndef, Eq(EXPECTED_TRUE)); // nothing change with the undefined optional param
    modifier_->setPrevMargin(node_, &OPT_LEN_VP_POS, nullptr);
    auto checkOptNull = GetAttrValue<std::string>(node_, propNameOpt);
    EXPECT_THAT(checkOptNull, Eq(EXPECTED_TRUE)); // nothing change with no optional param
    modifier_->setPrevMargin(node_, &OPT_LEN_VP_POS, &OPT_BOOL_FALSE);
    auto checkOptFalse = GetAttrValue<std::string>(node_, propNameOpt);
    EXPECT_THAT(checkOptFalse, Eq(EXPECTED_FALSE));
}
/**
 * @tc.name: setNextMarginTest
 * @tc.desc: Check the functionality of SwiperModifier.NextMarginImpl
 * @tc.type: FUNC
 */
HWTEST_F(SwiperModifierTest, DISABLED_setNextMarginTest, TestSize.Level1)
{
    constexpr auto propName = "nextMargin";
    constexpr auto propNameOpt = "nextMarginIgnoreBlank";
    const std::string &defaultValue(EXPECTED_VP_ZERO);
    ASSERT_NE(modifier_->setNextMargin, nullptr);

    // test init state
    auto checkInit = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkInit, Eq(defaultValue));
    auto checkInitOpt = GetAttrValue<std::string>(node_, propNameOpt);
    EXPECT_THAT(checkInitOpt, Eq(EXPECTED_FALSE));

    // test the main arg
    modifier_->setNextMargin(node_, &OPT_LEN_VP_POS, nullptr);
    auto checkPxPos = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkPxPos, Eq(EXPECTED_VP_POS));
    modifier_->setNextMargin(node_, &OPT_LEN_VP_NEG, nullptr);
    auto checkVpNeg = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkVpNeg, Eq(defaultValue));

    // test the optional arg
    modifier_->setNextMargin(node_, &OPT_LEN_VP_POS, &OPT_BOOL_TRUE);
    auto checkOptTrue = GetAttrValue<std::string>(node_, propNameOpt);
    EXPECT_THAT(checkOptTrue, Eq(EXPECTED_TRUE));
    modifier_->setNextMargin(node_, &OPT_LEN_VP_POS, &OPT_BOOL_UNDEF);
    auto checkOptUndef = GetAttrValue<std::string>(node_, propNameOpt);
    EXPECT_THAT(checkOptUndef, Eq(EXPECTED_TRUE)); // nothing change with the undefined optional param
    modifier_->setNextMargin(node_, &OPT_LEN_VP_POS, nullptr);
    auto checkOptNull = GetAttrValue<std::string>(node_, propNameOpt);
    EXPECT_THAT(checkOptNull, Eq(EXPECTED_TRUE)); // nothing change with no optional param
    modifier_->setNextMargin(node_, &OPT_LEN_VP_POS, &OPT_BOOL_FALSE);
    auto checkOptFalse = GetAttrValue<std::string>(node_, propNameOpt);
    EXPECT_THAT(checkOptFalse, Eq(EXPECTED_FALSE));
}
/**
 * @tc.name: setOnAnimationStartTest
 * @tc.desc: Check the functionality of SwiperModifier.OnAnimationStartImpl
 * @tc.type: FUNC
 */
HWTEST_F(SwiperModifierTest, setOnAnimationStartTest, TestSize.Level1)
{
    auto frameNode = reinterpret_cast<FrameNode*>(node_);
    ASSERT_NE(frameNode, nullptr);
    auto eventHub = frameNode->GetEventHub<NG::SwiperEventHub>();
    ASSERT_NE(eventHub, nullptr);

    struct CheckEvent {
        int32_t nodeId;
        int32_t index;
        int32_t targetIndex;
        AnimationCallbackInfo info;
    };
    static std::optional<CheckEvent> checkEvent = std::nullopt;
    auto checkCallback =
        [](const Ark_Int32 resourceId, const Ark_Int32 index, const Ark_Int32 targetIndex,
        const Ark_SwiperAnimationEvent extraInfo) {
            checkEvent = {
                .nodeId = resourceId,
                .index = Converter::Convert<Ark_Int32>(index),
                .targetIndex = Converter::Convert<Ark_Int32>(targetIndex),
                .info = {
                    .currentOffset = Converter::Convert<Ark_Float32>(extraInfo.currentOffset),
                    .targetOffset = Converter::Convert<Ark_Float32>(extraInfo.targetOffset),
                    .velocity = Converter::Convert<Ark_Float32>(extraInfo.velocity),
                }
            };
        };
    auto func = Converter::ArkValue<OnSwiperAnimationStartCallback>(checkCallback, CONTEXT_ID);
    auto optCallback = Converter::ArkValue<Opt_OnSwiperAnimationStartCallback>(func);

    ASSERT_NE(modifier_->setOnAnimationStart, nullptr);

    modifier_->setOnAnimationStart(node_, &optCallback);

    EXPECT_EQ(checkEvent.has_value(), false);
    eventHub->FireAnimationStartEvent(123, 456, {
        .currentOffset = 1.23f,
        .targetOffset = -4.56f,
        .velocity = 78.9f,
    });
    ASSERT_EQ(checkEvent.has_value(), true);
    EXPECT_EQ(checkEvent->nodeId, CONTEXT_ID);
    EXPECT_EQ(checkEvent->index, 123);
    EXPECT_EQ(checkEvent->targetIndex, 456);
    EXPECT_EQ(checkEvent->info.currentOffset, 1.23f);
    EXPECT_EQ(checkEvent->info.targetOffset, -4.56f);
    EXPECT_EQ(checkEvent->info.velocity, 78.9f);
}
/**
 * @tc.name: setOnAnimationEndTest
 * @tc.desc: Check the functionality of SwiperModifier.OnAnimationEndImpl
 * @tc.type: FUNC
 */
HWTEST_F(SwiperModifierTest, setOnAnimationEndTest, TestSize.Level1)
{
    auto frameNode = reinterpret_cast<FrameNode*>(node_);
    ASSERT_NE(frameNode, nullptr);
    auto eventHub = frameNode->GetEventHub<NG::SwiperEventHub>();
    ASSERT_NE(eventHub, nullptr);

    struct CheckEvent {
        int32_t nodeId;
        int32_t index;
        AnimationCallbackInfo info;
    };
    static std::optional<CheckEvent> checkEvent = std::nullopt;
    auto checkCallback =
        [](const Ark_Int32 resourceId, const Ark_Int32 index, const Ark_SwiperAnimationEvent extraInfo) {
            checkEvent = {
            .nodeId = resourceId,
            .index = Converter::Convert<Ark_Int32>(index),
            .info = {
                .currentOffset = Converter::Convert<Ark_Float32>(extraInfo.currentOffset),
                .targetOffset = Converter::Convert<Ark_Float32>(extraInfo.targetOffset),
                .velocity = Converter::Convert<Ark_Float32>(extraInfo.velocity),
            }
        };
        };
    auto func = Converter::ArkValue<OnSwiperAnimationEndCallback>(checkCallback, CONTEXT_ID);
    auto optCallback = Converter::ArkValue<Opt_OnSwiperAnimationEndCallback>(func);

    // the start animation before is required for the end of animation testing
    eventHub->FireAnimationStartEvent(0, 0, {});

    ASSERT_NE(modifier_->setOnAnimationEnd, nullptr);

    modifier_->setOnAnimationEnd(node_, &optCallback);

    EXPECT_EQ(checkEvent.has_value(), false);
    eventHub->FireAnimationEndEvent(321, {
        .currentOffset = 1.23f,
        .targetOffset = -4.56f,
        .velocity = 78.9f,
    });
    ASSERT_EQ(checkEvent.has_value(), true);
    EXPECT_EQ(checkEvent->nodeId, CONTEXT_ID);
    EXPECT_EQ(checkEvent->index, 321);
    EXPECT_EQ(checkEvent->info.currentOffset, 1.23f);
    EXPECT_EQ(checkEvent->info.targetOffset, -4.56f);
    EXPECT_EQ(checkEvent->info.velocity, 78.9f);
}
/**
 * @tc.name: setOnGestureSwipeTest
 * @tc.desc: Check the functionality of SwiperModifier.OnGestureSwipeImpl
 * @tc.type: FUNC
 */
HWTEST_F(SwiperModifierTest, setOnGestureSwipeTest, TestSize.Level1)
{
    auto frameNode = reinterpret_cast<FrameNode*>(node_);
    ASSERT_NE(frameNode, nullptr);
    auto eventHub = frameNode->GetEventHub<NG::SwiperEventHub>();
    ASSERT_NE(eventHub, nullptr);

    struct CheckEvent {
        int32_t nodeId;
        int32_t index;
        AnimationCallbackInfo info;
    };
    static std::optional<CheckEvent> checkEvent = std::nullopt;
    auto checkCallback =
        [](const Ark_Int32 resourceId, const Ark_Int32 index, const Ark_SwiperAnimationEvent extraInfo) {
            checkEvent = {
                .nodeId = resourceId,
                .index = Converter::Convert<Ark_Int32>(index),
                .info = {
                    .currentOffset = Converter::Convert<Ark_Float32>(extraInfo.currentOffset),
                    .targetOffset = Converter::Convert<Ark_Float32>(extraInfo.targetOffset),
                    .velocity = Converter::Convert<Ark_Float32>(extraInfo.velocity),
                }
            };
        };
    auto func = Converter::ArkValue<OnSwiperGestureSwipeCallback>(checkCallback, CONTEXT_ID);
    auto optCallback = Converter::ArkValue<Opt_OnSwiperGestureSwipeCallback>(func);

    ASSERT_NE(modifier_->setOnGestureSwipe, nullptr);

    modifier_->setOnGestureSwipe(node_, &optCallback);

    EXPECT_EQ(checkEvent.has_value(), false);
    eventHub->FireGestureSwipeEvent(321, {
        .currentOffset = 1.23f,
        .targetOffset = -4.56f,
        .velocity = 78.9f,
    });
    ASSERT_EQ(checkEvent.has_value(), true);
    EXPECT_EQ(checkEvent->nodeId, CONTEXT_ID);
    EXPECT_EQ(checkEvent->index, 321);
    EXPECT_EQ(checkEvent->info.currentOffset, 1.23f);
    EXPECT_EQ(checkEvent->info.targetOffset, -4.56f);
    EXPECT_EQ(checkEvent->info.velocity, 78.9f);
}
/**
 * @tc.name: setNestedScrollTest
 * @tc.desc: Check the functionality of SwiperModifier.NestedScrollImpl
 * @tc.type: FUNC
 */
HWTEST_F(SwiperModifierTest, DISABLED_setNestedScrollTest, TestSize.Level1)
{
    ASSERT_NE(modifier_->setNestedScroll, nullptr);
    // the result can't be checked due to nothing corresponded attributes in JSON object,
    // that is provided by the SwiperPattern::ToJsonValue and SwiperLayoutProperty::ToJsonValue
}
/**
 * @tc.name: setCustomContentTransitionTest
 * @tc.desc: Check the functionality of SwiperModifier.CustomContentTransitionImpl
 * @tc.type: FUNC
 */
HWTEST_F(SwiperModifierTest, setCustomContentTransitionTest, TestSize.Level1)
{
    ASSERT_NE(modifier_->setCustomContentTransition, nullptr);

    const int32_t timeOut = 1000;
    const int32_t contextId = 123;
    const int32_t expectedIndexValue = 2342;

    ASSERT_NE(fullAPI_->getAccessors(), nullptr);
    static const auto *accessor = fullAPI_->getAccessors()->getSwiperContentTransitionProxyAccessor();
    ASSERT_NE(accessor, nullptr);
    ASSERT_NE(accessor->getFinalizer, nullptr);
    ASSERT_NE(accessor->getIndex, nullptr);

    static std::optional<std::pair<int32_t, int32_t>> checkInvoke;
    void (*fakeDeveloperCallbackFunc)(const Ark_Int32 resourceId, const Ark_SwiperContentTransitionProxy parameter) =
        [](const Ark_Int32 resourceId, const Ark_SwiperContentTransitionProxy peer) {
            // get to further test: incoming resource, data from incoming peer via accessor
            checkInvoke = {
                resourceId,
                Converter::Convert<int32_t>(accessor->getIndex(peer))
            };

            auto destroy = reinterpret_cast<void (*)(SwiperContentTransitionProxyPeer *)>(accessor->getFinalizer());
            if (destroy) {
                (*destroy)(peer);
            }
        };
    ASSERT_FALSE(checkInvoke.has_value());

    // setup the callback object via C-API
    Ark_SwiperContentAnimatedTransition transition {
        .timeout = ArkValue<Opt_Int32>(timeOut),
        .transition = ArkValue<Callback_SwiperContentTransitionProxy_Void>(fakeDeveloperCallbackFunc, CONTEXT_ID)
    };
    auto transitionOpt = Converter::ArkValue<Opt_SwiperContentAnimatedTransition>(transition);
    modifier_->setCustomContentTransition(node_, &transitionOpt);

    // check the callback object that was setup
    auto frameNode = reinterpret_cast<FrameNode *>(node_);
    ASSERT_NE(frameNode, nullptr);
    auto pattern = frameNode->GetPattern<SwiperPattern>();
    ASSERT_NE(pattern, nullptr);
    auto swiperContentAnimatedTransition = pattern->GetSwiperCustomContentTransition();
    ASSERT_NE(swiperContentAnimatedTransition, nullptr);
    EXPECT_EQ(swiperContentAnimatedTransition->timeout, timeOut);
    ASSERT_NE(swiperContentAnimatedTransition->transition, nullptr);

    // simulate of the callback function invoking from ace_engine part
    auto swiperContentTransitionProxy = AceType::MakeRefPtr<SwiperContentTransitionProxy>();
    swiperContentTransitionProxy->SetIndex(expectedIndexValue);
    swiperContentAnimatedTransition->transition(swiperContentTransitionProxy);

    // check the invoking result
    ASSERT_TRUE(checkInvoke.has_value());
    EXPECT_EQ(checkInvoke.value().first, contextId);
    EXPECT_EQ(checkInvoke.value().second, expectedIndexValue);
}
/**
 * @tc.name: setOnContentDidScrollTest
 * @tc.desc: Check the functionality of SwiperModifier.OnContentDidScrollImpl
 * @tc.type: FUNC
 */
HWTEST_F(SwiperModifierTest, setOnContentDidScrollTest, TestSize.Level1)
{
    struct OnDidScrollParams {
        int32_t nodeId;
        int32_t selectedIndex;
        int32_t index;
        float position;
        float mainAxisLength;
    };

    struct OnDidScrollParams expected {
        reinterpret_cast<UINode *>(node_)->GetId(),
        1122,
        3344,
        55.66f,
        77.88f,
    };

    static std::optional<OnDidScrollParams> checkEvent = std::nullopt;
    auto checkCallback =
        [](const Ark_Int32 resourceId, Ark_Int32 selectedIndex,
            Ark_Int32 index, Ark_Float64 position, Ark_Float64 mainAxisLength) {
            checkEvent = {
                .nodeId = resourceId,
                .selectedIndex = Converter::Convert<int32_t>(selectedIndex),
                .index = Converter::Convert<int32_t>(index),
                .position = Converter::Convert<float>(position),
                .mainAxisLength = Converter::Convert<float>(mainAxisLength),
            };
        };
    auto func = Converter::ArkValue<ContentDidScrollCallback>(checkCallback, CONTEXT_ID);
    auto optCallback = Converter::ArkValue<Opt_ContentDidScrollCallback>(func);

    EXPECT_NE(modifier_->setOnContentDidScroll, nullptr);
    EXPECT_FALSE(checkEvent);

    modifier_->setOnContentDidScroll(node_, &optCallback);

    // check the callback func that was setup
    auto frameNode = reinterpret_cast<FrameNode *>(node_);
    ASSERT_NE(frameNode, nullptr);
    auto pattern = frameNode->GetPattern<SwiperPattern>();
    ASSERT_NE(pattern, nullptr);
    auto onContentDidScroll = pattern->GetOnContentDidScroll();
    ASSERT_NE(onContentDidScroll, nullptr);

    // simulate the callback invoking from ace_engine
    (*onContentDidScroll.get())(expected.selectedIndex, expected.index, expected.position, expected.mainAxisLength);
    ASSERT_TRUE(checkEvent);
    EXPECT_EQ(checkEvent->nodeId, CONTEXT_ID);
    EXPECT_EQ(checkEvent->selectedIndex, expected.selectedIndex);
    EXPECT_EQ(checkEvent->index, expected.index);
    EXPECT_EQ(checkEvent->position, expected.position);
    EXPECT_EQ(checkEvent->mainAxisLength, expected.mainAxisLength);
}
/**
 * @tc.name: setIndicatorInteractiveTest
 * @tc.desc: Check the functionality of SwiperModifier.IndicatorInteractiveImpl
 * @tc.type: FUNC
 */
HWTEST_F(SwiperModifierTest, DISABLED_setIndicatorInteractiveTest, TestSize.Level1)
{
    constexpr auto propName = "indicatorInteractive";
    const std::string &defaultValue(EXPECTED_TRUE);
    ASSERT_NE(modifier_->setIndicatorInteractive, nullptr);

    auto checkInitial = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkInitial, Eq(defaultValue));

    modifier_->setIndicatorInteractive(node_, &OPT_BOOL_FALSE);
    auto checkFalse = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkFalse, Eq(EXPECTED_FALSE));

    modifier_->setIndicatorInteractive(node_, &OPT_BOOL_TRUE);
    auto checkTrue = GetAttrValue<std::string>(node_, propName);
    EXPECT_THAT(checkTrue, Eq(EXPECTED_TRUE));
}

#ifdef WRONG_OLD_GEN
/*
 * @tc.name: set_onChangeEvent_indexTestValidCallback
 * @tc.desc:
 * @tc.type: FUNC
 */
HWTEST_F(SwiperModifierTest, set_onChangeEvent_indexTestValidCallback, TestSize.Level1)
{
    auto frameNode = reinterpret_cast<FrameNode*>(node_);
    auto eventHub = frameNode->GetEventHub<SwiperEventHub>();
    ASSERT_NE(eventHub, nullptr);

    struct CheckEvent {
        int32_t nodeId;
        std::optional<int32_t> value;
    };
    static std::optional<CheckEvent> checkEvent = std::nullopt;
    static constexpr int32_t contextId = 123;

    auto checkCallback = [](const Ark_Int32 resourceId, const Opt_Number parameter) {
        checkEvent = {
            .nodeId = resourceId,
            .value = Converter::OptConvert<int32_t>(parameter)
        };
    };

    auto arkCallback = Converter::ArkValue<Callback_Opt_Number_Void>(checkCallback, contextId);
    modifier_->set_onChangeEvent_index(node_, &arkCallback);

    ASSERT_EQ(checkEvent.has_value(), false);
    eventHub->FireChangeEvent(0, 1, false);
    ASSERT_EQ(checkEvent.has_value(), true);
    EXPECT_EQ(checkEvent->nodeId, contextId);
    EXPECT_EQ(checkEvent->value, 1);
    eventHub->FireChangeEvent(1, 2, false);
    ASSERT_EQ(checkEvent.has_value(), true);
    EXPECT_EQ(checkEvent->nodeId, contextId);
    EXPECT_EQ(checkEvent->value, 2);
}
#endif
} // namespace OHOS::Ace::NG