/*
 *  * Copyright (C) 2024, KylinSoft Co., Ltd.
 *  *
 *  * This program is free software: you can redistribute it and/or modify
 *  * it under the terms of the GNU General Public License as published by
 *  * the Free Software Foundation, either version 3 of the License, or
 *  * (at your option) any later version.
 *  *
 *  * This program is distributed in the hope that it will be useful,
 *  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  * GNU General Public License for more details.
 *  *
 *  * You should have received a copy of the GNU General Public License
 *  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 *  *
 *  * Authors: like <like1@kylinos.cn>
 *
 */
#include <QtTest>
#include <dlfcn.h>
#include <QMenu>
#include <QPushButton>
#include <QListView>
#include <QColor>
#include <QPainter>
#include <QPixmap>
#include <QStyleOption>
#include <QtCore>
#include <QMetaObject>
#include <QFileDialog>
#include <QScrollBar>
#include <QTabWidget>
#include <QSpinBox>
#include <QRadioButton>
#include <QCheckBox>
#include <QTouchEvent>

#include "../libqt5-ukui-style/effects/highlight-effect.h"
#include "../libqt5-ukui-style/settings/application-style-settings.h"
#include "../libqt5-ukui-style/settings/ukui-style-conf-settings.h"
#include "../libqt5-ukui-style/settings/ukui-style-settings.h"
#include "../libqt5-ukui-style/settings/black-list.h"

#include "../libqt5-ukui-style/animations/scrollbar/ukui-scrollbar-default-interaction-animator.h"
#include "../libqt5-ukui-style/animations/tabwidget/ukui-tabwidget-animator-iface.h"
#include "../libqt5-ukui-style/animations/tabwidget/ukui-tabwidget-animator-plugin-iface.h"
#include "../libqt5-ukui-style/animations/tabwidget/ukui-tabwidget-default-slide-animator-factory.h"
#include "../libqt5-ukui-style/animations/tabwidget/ukui-tabwidget-default-slide-animator.h"
#include "../libqt5-ukui-style/gestures/ukui-two-finger-slide-gesture.h"
#include "../libqt5-ukui-style/gestures/ukui-two-finger-zoom-gesture.h"
#include "../ukui-styles/readconfig.h"
#include "../ukui-styles/qt5-config-style-ukui/ukui-config-style.h"
#include "../ukui-styles/blur-helper.h"
#include "../ukui-styles/gesture-helper.h"
#include "../ukui-styles/window-manager.h"
#include "../ukui-styles/ukui-style-plugin.h"
#include "../ukui-styles/qt5-config-style-ukui/config-shadow-helper.h"
#include "../ukui-styles/qt5-config-style-ukui/config-style-helper.h"
#include "../ukui-styles/qt5-config-style-ukui/ukui-config-style-parameters.h"
#include "../ukui-styles/qt5-config-style-ukui/animations/config-box-animation-helper.h"
#include "../ukui-styles/qt5-config-style-ukui/animations/config-box-animator.h"
#include "../ukui-styles/qt5-config-style-ukui/animations/config-button-animation-helper.h"
#include "../ukui-styles/qt5-config-style-ukui/animations/config-button-animator.h"
#include "../ukui-styles/qt5-config-style-ukui/animations/config-checkbox-animation-helper.h"
#include "../ukui-styles/qt5-config-style-ukui/animations/config-checkbox-animator.h"
#include "../ukui-styles/qt5-config-style-ukui/animations/config-progressbar-animation.h"
#include "../ukui-styles/qt5-config-style-ukui/animations/config-progressbar-animation-helper.h"
#include "../ukui-styles/qt5-config-style-ukui/animations/config-radiobutton-animation-helper.h"
#include "../ukui-styles/qt5-config-style-ukui/animations/config-radiobutton-animator.h"
#include "../ukui-styles/qt5-config-style-ukui/animations/config-scrollbar-animation-helper.h"
#include "../ukui-styles/qt5-config-style-ukui/animations/config-slider-animation-helper.h"
#include "../ukui-styles/qt5-config-style-ukui/animations/config-slider-animator.h"
#include "../ukui-styles/qt5-config-style-ukui/animations/config-tab-widget-animation-helper.h"
#include "../ukui-styles/qt5-config-style-ukui/animations/config-tree-animation-helper.h"
#include "../ukui-styles/qt5-config-style-ukui/animations/config-tree-animator.h"
#include "../ukui-styles/themeinformation.h"


#include "../qt5-ukui-filedialog/debug.h"
#include "../qt5-ukui-filedialog/filedialogplugin.h"
#include "../qt5-ukui-filedialog/kyfiledialogprivate.h"
#include "../qt5-ukui-filedialog/menutoolbutoon.h"
#include "../qt5-ukui-filedialog/pathbar.h"
#include "../qt5-ukui-filedialog/sidebar.h"
#include "../qt5-ukui-filedialog/uikyfiledialog.h"
#include "../qt5-ukui-filedialog/kyfiledialog.h"

// 定义函数指针类型，与库中函数的签名匹配
typedef void (*FunctionInLibType)(void);

// 测试用例类，继承自QObject
class LibFunctionTest : public QObject
{
    Q_OBJECT
public:

private Q_SLOTS:

    // 测试调用库中函数的功能
    void testFunctionInLib()
    {
        QWidget *w = new QWidget ;

        HighLightEffect::setSkipEffect(w, true);
        w->show();

        const QPixmap pixmap(QSize(100, 100));
        // 创建pixmap的一个可修改副本，用于后续绘制操作
        QPixmap modifiablePixmap = pixmap;
        // 使用QPainter在可修改的副本上进行绘制
        QPainter painter(&modifiablePixmap);
        painter.setBrush(Qt::red);
        painter.drawRect(10, 10, 80, 80);
        painter.end();

        bool isPixmapPureColor =  HighLightEffect::isPixmapPureColor(pixmap);
        bool isSymbolicColor =  HighLightEffect::isSymbolicColor(pixmap);

        QMenu *menu = new QMenu();
        bool setMenuIconHighlightEffect = HighLightEffect::setMenuIconHighlightEffect(menu, HighLightEffect::skipHighlight, HighLightEffect::HighlightOnly);

//        QListView *view = new QListView();
//        bool setViewItemIconHighlightEffect = HighLightEffect::setViewItemIconHighlightEffect(view,  HighLightEffect::skipHighlight, HighLightEffect::HighlightOnly);

        HighLightEffect::HighLightMode mode = HighLightEffect::isWidgetIconUseHighlightEffect(w);

        const QColor &color = QColor(255, 0, 0);
        HighLightEffect::setSymoblicColor(color);
        HighLightEffect::setWidgetIconFillSymbolicColor(w, true);

        const QColor getCurrentSymbolicColor =  HighLightEffect::getCurrentSymbolicColor();

        // 通过静态方法获取实例指针
        ApplicationStyleSettings *settingsPtr = ApplicationStyleSettings::getInstance();

        // 测试setColorStretagy方法
        ApplicationStyleSettings::ColorStretagy colorStretagy = ApplicationStyleSettings::Bright;
        settingsPtr->setColorStretagy(colorStretagy);


        // 测试setStyleStretagy方法
        ApplicationStyleSettings::StyleStretagy styleStretagy = ApplicationStyleSettings::Default;
        settingsPtr->setStyleStretagy(styleStretagy);


        // 测试setCustomStyle方法
        QString customStyle = "MyCustomStyle";
        settingsPtr->setCustomStyle(customStyle);


        // 测试setColor方法
        QPalette::ColorRole role = QPalette::Window;
        QColor setcolor(Qt::red);
        QPalette::ColorGroup group = QPalette::Active;
        settingsPtr->setColor(role, setcolor, group);

        // 获取设置后的颜色并验证
        QColor retrievedColor = settingsPtr->getColor(role, group);

        // 例如，连接colorStretageChanged信号到一个槽函数（这里使用lambda表达式模拟槽函数）
        bool colorStretageChangedReceived = false;

        // 更改颜色策略，触发信号发射
        ApplicationStyleSettings::ColorStretagy newColorStretagy = ApplicationStyleSettings::System;
        settingsPtr->setColorStretagy(newColorStretagy);

        QByteArray schemaId("test_schema");
        ukuiStyleConfSettings* confinstance = new ukuiStyleConfSettings(schemaId);
        delete confinstance;


        UKUIStyleSettings *ukuisettingsPtr = UKUIStyleSettings::globalInstance();
//        delete ukuisettingsPtr;
    }

    void testAllHighLightEffectMethods()
    {
        // 测试 setSkipEffect 方法
        qDebug() << "Testing setSkipEffect...";
        QWidget widget;
        HighLightEffect::setSkipEffect(&widget, true);
        qDebug() << "skipHighlightIconEffect property after set to true:" << widget.property("skipHighlightIconEffect").toBool();
        HighLightEffect::setSkipEffect(&widget, false);
        qDebug() << "skipHighlightIconEffect property after set to false:" << widget.property("skipHighlightIconEffect").toBool();


        // 测试 isPixmapPureColor 方法
        qDebug() << "Testing isPixmapPureColor...";
        QPixmap purePixmap(10, 10);
        purePixmap.fill(QColor(38, 38, 38));
        qDebug() << "isPixmapPureColor for pure pixmap:" << HighLightEffect::isPixmapPureColor(purePixmap);
        QPixmap impurePixmap(10, 10);
        impurePixmap.fill(QColor(38, 38, 39));
        qDebug() << "isPixmapPureColor for impure pixmap:" << HighLightEffect::isPixmapPureColor(impurePixmap);
        QPixmap nullPixmap;
        qDebug() << "isPixmapPureColor for null pixmap:" << HighLightEffect::isPixmapPureColor(nullPixmap);


        // 测试 isSymbolicColor 方法
        qDebug() << "Testing isSymbolicColor...";
        QPixmap symbolicPixmap(10, 10);
        symbolicPixmap.fill(QColor(38, 38, 38));
        qDebug() << "isSymbolicColor for symbolic pixmap:" << HighLightEffect::isSymbolicColor(symbolicPixmap);
        QPixmap nonSymbolicPixmap(10, 10);
        nonSymbolicPixmap.fill(QColor(38, 38, 39));
        qDebug() << "isSymbolicColor for non-symbolic pixmap:" << HighLightEffect::isSymbolicColor(nonSymbolicPixmap);
        qDebug() << "isSymbolicColor for null pixmap:" << HighLightEffect::isSymbolicColor(nullPixmap);


        // 测试 setMenuIconHighlightEffect 方法
        qDebug() << "Testing setMenuIconHighlightEffect...";
        QMenu menu;
        HighLightEffect::setMenuIconHighlightEffect(&menu, HighLightEffect::HighlightEffect, HighLightEffect::BothDefaultAndHighlit);
        qDebug() << "useIconHighlightEffect property after setMenuIconHighlightEffect:" << menu.property("useIconHighlightEffect").toInt();
        qDebug() << "iconHighlightEffectMode property after setMenuIconHighlightEffect:" << menu.property("iconHighlightEffectMode").toInt();


        // 测试 setViewItemIconHighlightEffect 方法
        qDebug() << "Testing setViewItemIconHighlightEffect...";
        QTreeView view;
        HighLightEffect::setViewItemIconHighlightEffect(&view, HighLightEffect::HighlightEffect, HighLightEffect::BothDefaultAndHighlit);
        qDebug() << "useIconHighlightEffect property of viewport after setViewItemIconHighlightEffect:" << view.viewport()->property("useIconHighlightEffect").toInt();
        qDebug() << "iconHighlightEffectMode property of viewport after setViewItemIconHighlightEffect:" << view.viewport()->property("iconHighlightEffectMode").toInt();

        // 测试 isWidgetIconUseHighlightEffect 方法
        qDebug() << "Testing isWidgetIconUseHighlightEffect...";
        HighLightEffect::setSkipEffect(&menu, true);
        qDebug() << "isWidgetIconUseHighlightEffect when skipHighlight is set:" << HighLightEffect::isWidgetIconUseHighlightEffect(&menu);
        HighLightEffect::setMenuIconHighlightEffect(&menu, HighLightEffect::HighlightEffect, HighLightEffect::BothDefaultAndHighlit);
        qDebug() << "isWidgetIconUseHighlightEffect after setMenuIconHighlightEffect:" << HighLightEffect::isWidgetIconUseHighlightEffect(&menu);


        // 测试 setSymoblicColor 方法
        qDebug() << "Testing setSymoblicColor...";
        QColor newColor(50, 50, 50);
        HighLightEffect::setSymoblicColor(newColor);
        qDebug() << "symbolic_color after setSymoblicColor:" << HighLightEffect::symbolic_color;


        // 测试 setWidgetIconFillSymbolicColor 方法
        qDebug() << "Testing setWidgetIconFillSymbolicColor...";
        HighLightEffect::setWidgetIconFillSymbolicColor(&widget, true);
        qDebug() << "fillIconSymbolicColor property after set to true:" << widget.property("fillIconSymbolicColor").toBool();
        HighLightEffect::setWidgetIconFillSymbolicColor(&widget, false);
        qDebug() << "fillIconSymbolicColor property after set to false:" << widget.property("fillIconSymbolicColor").toBool();


        // 测试 getCurrentSymbolicColor 方法
        qDebug() << "Testing getCurrentSymbolicColor...";
        QColor originalSymbolicColor = HighLightEffect::symbolic_color;
        QColor newSymbolicColor = HighLightEffect::getCurrentSymbolicColor();
        qDebug() << "getCurrentSymbolicColor result:" << newSymbolicColor;
        qDebug() << "symbolic_color after getCurrentSymbolicColor:" << HighLightEffect::symbolic_color;


        // 测试 defaultStyleDark 方法
        qDebug() << "Testing defaultStyleDark...";
        QStyleOption option;
        QColor darkColor = HighLightEffect::defaultStyleDark(&option);
        qDebug() << "defaultStyleDark result:" << darkColor;


        // 测试 generatePixmap 方法
        qDebug() << "Testing generatePixmap...";
        QPixmap pixmap(10, 10);
        pixmap.fill(QColor(38, 38, 38));
        QStyleOption option2;
        QWidget widget2;

        // 测试 force 为 true 的情况
        qDebug() << "generatePixmap with force true:";
        QPixmap result = HighLightEffect::generatePixmap(pixmap, &option2, &widget2, true);
        qDebug() << "generatePixmap result (force true):" << result;

        // 测试各种 HighLightMode 和 EffectMode 组合
        widget2.setProperty("skipHighlightIconEffect", false);
        widget2.setProperty("iconHighlightEffectMode", HighLightEffect::BothDefaultAndHighlit);
        qDebug() << "generatePixmap with skipHighlightIconEffect false and iconHighlightEffectMode set:";
        result = HighLightEffect::generatePixmap(pixmap, &option2, &widget2, false);
        qDebug() << "generatePixmap result (skipHighlightIconEffect false and iconHighlightEffectMode set):" << result;

        widget2.setProperty("useIconHighlightEffect", HighLightEffect::HighlightEffect);
        qDebug() << "generatePixmap with useIconHighlightEffect set to HighlightEffect:";
        result = HighLightEffect::generatePixmap(pixmap, &option2, &widget2, false);
        qDebug() << "generatePixmap result (useIconHighlightEffect set to HighlightEffect):" << result;

        widget2.setProperty("useIconHighlightEffect", HighLightEffect::ordinaryHighLight);
        qDebug() << "generatePixmap with useIconHighlightEffect set to ordinaryHighLight:";
        result = HighLightEffect::generatePixmap(pixmap, &option2, &widget2, false);
        qDebug() << "generatePixmap result (useIconHighlightEffect set to ordinaryHighLight):" << result;

        widget2.setProperty("useIconHighlightEffect", HighLightEffect::hoverHighLight);
        qDebug() << "generatePixmap with useIconHighlightEffect set to hoverHighLight:";
        result = HighLightEffect::generatePixmap(pixmap, &option2, &widget2, false);
        qDebug() << "generatePixmap result (useIconHighlightEffect set to hoverHighLight):" << result;

        widget2.setProperty("useIconHighlightEffect", HighLightEffect::defaultHighLight);
        qDebug() << "generatePixmap with useIconHighlightEffect set to defaultHighLight:";
        result = HighLightEffect::generatePixmap(pixmap, &option2, &widget2, false);
        qDebug() << "generatePixmap result (useIconHighlightEffect set to defaultHighLight):" << result;

        widget2.setProperty("useIconHighlightEffect", HighLightEffect::filledSymbolicColorHighLight);
        qDebug() << "generatePixmap with useIconHighlightEffect set to filledSymbolicColorHighLight:";
        result = HighLightEffect::generatePixmap(pixmap, &option2, &widget2, false);
        qDebug() << "generatePixmap result (useIconHighlightEffect set to filledSymbolicColorHighLight):" << result;


        // 测试 ordinaryGeneratePixmap 方法
        qDebug() << "Testing ordinaryGeneratePixmap...";
        QPixmap pixmap2(10, 10);
        pixmap2.fill(QColor(38, 38, 38));
        QStyleOption option3;
        QWidget widget3;
        qDebug() << "ordinaryGeneratePixmap result:" << HighLightEffect::ordinaryGeneratePixmap(pixmap2, &option3, &widget3, HighLightEffect::BothDefaultAndHighlit);


        // 测试 hoverGeneratePixmap 方法
        qDebug() << "Testing hoverGeneratePixmap...";
        QPixmap pixmap3(10, 10);
        pixmap3.fill(QColor(38, 38, 38));
        QStyleOption option4;
        QWidget widget4;
        qDebug() << "hoverGeneratePixmap result:" << HighLightEffect::hoverGeneratePixmap(pixmap3, &option4, &widget4, HighLightEffect::BothDefaultAndHighlit);

        QPixmap pixmap3_1(10, 10);
        pixmap3_1 = QIcon::fromTheme("user-home-symbolic").pixmap(10,10);
        QStyleOption option3_1;
        QWidget widget3_1;
        qDebug() << "hoverGeneratePixmap result:" << HighLightEffect::filledSymbolicColoredGeneratePixmap(pixmap3_1, &option3_1, &widget3_1, HighLightEffect::BothDefaultAndHighlit);

        // 测试 bothOrdinaryAndHoverGeneratePixmap 方法
        qDebug() << "Testing bothOrdinaryAndHoverGeneratePixmap...";
        QPixmap pixmap4(10, 10);
        pixmap4.fill(QColor(38, 38, 38));
        QStyleOption option5;
        QWidget widget5;
        qDebug() << "bothOrdinaryAndHoverGeneratePixmap result:" << HighLightEffect::bothOrdinaryAndHoverGeneratePixmap(pixmap4, &option5, &widget5, HighLightEffect::BothDefaultAndHighlit);


        // 测试 filledSymbolicColoredGeneratePixmap 方法
        qDebug() << "Testing filledSymbolicColoredGeneratePixmap...";
        QPixmap pixmap5(10, 10);
        pixmap5.fill(QColor(38, 38, 38));
        QStyleOption option6;
        QWidget widget6;
//        qDebug() << "filledSymbolicColoredGeneratePixmap result:" << HighLightEffect::filledSymbolicColoredGeneratePixmap(pixmap5, &option6, &widget6, HighLightEffect::SymbolicColor);
    }
    void testicontions()
    {
        // 创建 UKUIConfigStyle 实例
        UKUIConfigStyle configStyle("IconStyle");

        // 测试 generatedIconPixmap 函数
        // 测试 QIcon::Disabled 模式
        QPixmap originalPixmap(100, 100);
        originalPixmap.fill(Qt::red);
        QStyleOption option;
        configStyle.generatedIconPixmap(QIcon::Disabled, originalPixmap, &option);

        // 测试另一种情况，当原始 pixmap 为不同颜色
        QPixmap anotherPixmap(100, 100);
        anotherPixmap.fill(Qt::blue);
        configStyle.generatedIconPixmap(QIcon::Disabled, anotherPixmap, &option);

        // 测试当 pixmap 是纯色的情况
        configStyle.generatedIconPixmap(QIcon::Disabled, originalPixmap, &option);

        // 测试当 option 有不同的 palette 时
        QPalette palette;
        palette.setColor(QPalette::Disabled, QPalette::ButtonText, Qt::green);
        option.palette = palette;
        configStyle.generatedIconPixmap(QIcon::Disabled, originalPixmap, &option);

        // 测试其他 QIcon::Mode 的情况，这里只是简单调用，你可以根据实际情况添加更多逻辑
        configStyle.generatedIconPixmap(QIcon::Normal, originalPixmap, &option);


        // 测试 testGeneratedSVGPixmap 函数
        // 测试 testGeneratedSVGPixmap 函数
        configStyle.testGeneratedSVGPixmap(originalPixmap);

        // 测试当原始 pixmap 为不同颜色
        configStyle.testGeneratedSVGPixmap(anotherPixmap);

        // 测试当原始 pixmap 为透明时
        QPixmap transparentPixmap(100, 100);
        transparentPixmap.fill(Qt::transparent);
        configStyle.testGeneratedSVGPixmap(transparentPixmap);
    }
    void UKUIStyleConfSettingsTest(){
//        // 测试 qtify_name 函数
//        const char* testName1 = "hello-world";
//        QString result1 = qtify_name(testName1);
//        qDebug() << "qtify_name result: " << result1;

//        // 测试 unqtify_name 函数
//        QString testName2 = "HelloWorld";
//        char* result2 = unqtify_name(testName2);
//        qDebug() << "unqtify_name result: " << result2;
//        g_free(result2);

//         测试 ukuiStyleConfSettings 的构造函数和析构函数
        ukuiStyleConfSettings settings("test_schema");
//        qDebug() << "ukuiStyleConfSettings constructed.";

        // 测试 settingChanged 函数
        // 由于该函数是静态函数，并且依赖于 KSettings 的信号连接，这里无法直接调用测试，
        // 可通过后续的操作间接验证其是否正常工作


//        // 测试 types_to_qvariant 函数
//        ukuiStyleConfSettings testSettings("test_schema");
//        const char* testKey = "test_key";
//        const char* testValue = "123";
//        QVariant variant = testSettings.types_to_qvariant(testKey, testValue);
//        qDebug() << "types_to_qvariant result: " << variant;

////        // 测试 get 函数
//        QString getKey = "test_get_key";
//        QVariant getValue = testSettings.get(getKey);
//        qDebug() << "get result: " << getValue;


//        // 测试 set 函数
//        QString setKey = "test_set_key";
//        QVariant setValue = QVariant("test_set_value");
//        testSettings.set(setKey, setValue);
//        qDebug() << "set function called.";


//        // 测试 trySet 函数
//        QString trySetKey = "test_try_set_key";
//        QVariant trySetValue = QVariant("test_try_set_value");
//        bool trySetResult = testSettings.trySet(trySetKey, trySetValue);
//        qDebug() << "trySet result: " << trySetResult;


//        // 测试 keys 函数
//        QStringList keyList = testSettings.keys();
//        qDebug() << "keys result: " << keyList;


//        // 测试 reset 函数
//        QString resetKey = "test_reset_key";
//        testSettings.reset(resetKey);
//        qDebug() << "reset function called.";


//        // 测试 isSettingsAvailable 函数
//        QString schemaId = "test_schema_available";
//        bool available = ukuiStyleConfSettings::isSettingsAvailable(schemaId);
//        qDebug() << "isSettingsAvailable result: " << available;


//        // 额外的测试，确保不传入 0x0 作为 value 给 types_to_qvariant 函数
//        const char* validKey = "valid_key";
//        const char* validValue = "valid_value";
//        QVariant validVariant = testSettings.types_to_qvariant(validKey, validValue);
//        qDebug() << "types_to_qvariant with valid value result: " << validVariant;


//        // 可以添加更多测试用例，确保各种情况都能正确处理
//        // 例如，测试不同的数据类型转换
//        const char* boolValue = "true";
//        QVariant boolVariant = testSettings.types_to_qvariant("bool_key", boolValue);
//        qDebug() << "types_to_qvariant with boolean value result: " << boolVariant;


//        const char* intValue = "42";
//        QVariant intVariant = testSettings.types_to_qvariant("int_key", intValue);
//        qDebug() << "types_to_qvariant with integer value result: " << intVariant;


//        const char* doubleValue = "3.14";
//        QVariant doubleVariant = testSettings.types_to_qvariant("double_key", doubleValue);
//        qDebug() << "types_to_qvariant with double value result: " << doubleVariant;


//        const char* arrayValue = "['item1', 'item2']";
    }

    void testScrollBarAnimator(){

        QWidget parentWidget;
        UKUI::ScrollBar::DefaultInteractionAnimator animator(&parentWidget);

        // 测试bindWidget函数
        QScrollBar scrollBar;
        animator.bindWidget(&scrollBar);

        // 测试unboundWidget函数
        animator.unboundWidget();

        // 重新绑定测试，再次调用bindWidget
        animator.bindWidget(&scrollBar);

        // 测试value函数
        animator.value("groove_width");
        animator.value("slider_opacity");
        animator.value("additional_opacity");
        animator.value("move_position");
        animator.value("bg_width");

        // 测试setAnimatorStartValue和setAnimatorEndValue函数
        animator.setAnimatorStartValue("groove_width", 0.2);
        animator.setAnimatorEndValue("groove_width", 0.8);
        animator.setAnimatorStartValue("slider_opacity", 0.3);
        animator.setAnimatorEndValue("slider_opacity", 0.7);
        animator.setAnimatorStartValue("additional_opacity", 0.1);
        animator.setAnimatorEndValue("additional_opacity", 0.5);
        animator.setAnimatorStartValue("move_position", 0.0);
        animator.setAnimatorEndValue("move_position", 1.0);
        animator.setAnimatorStartValue("bg_width", 0.0);
        animator.setAnimatorEndValue("bg_width", 1.0);

        // 测试setAnimatorDuration函数
        animator.setAnimatorDuration("groove_width", 300);
        animator.setAnimatorDuration("slider_opacity", 250);
        animator.setAnimatorDuration("additional_opacity", 200);
        animator.setAnimatorDuration("move_position", 350);
        animator.setAnimatorDuration("bg_width", 280);

        // 测试setAnimatorDirectionForward函数
        animator.setAnimatorDirectionForward("groove_width", true);
        animator.setAnimatorDirectionForward("slider_opacity", false);
        animator.setAnimatorDirectionForward("additional_opacity", true);
        animator.setAnimatorDirectionForward("move_position", false);
        animator.setAnimatorDirectionForward("bg_width", true);

        // 测试isRunning函数
        animator.isRunning("groove_width");
        animator.isRunning("slider_opacity");
        animator.isRunning("additional_opacity");
        animator.isRunning("move_position");
        animator.isRunning("bg_width");

        // 测试startAnimator和stopAnimator函数
        animator.startAnimator("groove_width");
        animator.stopAnimator("groove_width");
        animator.startAnimator("slider_opacity");
        animator.stopAnimator("slider_opacity");
        animator.startAnimator("additional_opacity");
        animator.stopAnimator("additional_opacity");
        animator.startAnimator("move_position");
        animator.stopAnimator("move_position");
        animator.startAnimator("bg_width");
        animator.stopAnimator("bg_width");

        // 测试currentAnimatorTime和setAnimatorCurrentTime函数
        animator.startAnimator("groove_width");
        animator.setAnimatorCurrentTime("groove_width", 100);
        animator.currentAnimatorTime("groove_width");
        animator.startAnimator("slider_opacity");
        animator.setAnimatorCurrentTime("slider_opacity", 80);
        animator.currentAnimatorTime("slider_opacity");
        animator.startAnimator("additional_opacity");
        animator.setAnimatorCurrentTime("additional_opacity", 50);
        animator.currentAnimatorTime("additional_opacity");
        animator.startAnimator("move_position");
        animator.setAnimatorCurrentTime("move_position", 120);
        animator.currentAnimatorTime("move_position");
        animator.startAnimator("bg_width");
        animator.setAnimatorCurrentTime("bg_width", 90);
        animator.currentAnimatorTime("bg_width");

        // 测试setExtraProperty和getExtraProperty函数
        animator.setExtraProperty("end_position", 10);
        animator.setExtraProperty("start_position", 5);
        animator.setExtraProperty("addValue", true);
        animator.getExtraProperty("end_position");
        animator.getExtraProperty("start_position");
        animator.getExtraProperty("addValue");

        // 析构函数测试（通过对象生命周期结束自动调用析构函数来间接验证资源释放）
        {
            QWidget parentWidgetForDelete;
            UKUI::ScrollBar::DefaultInteractionAnimator* animatorOnHeap = new UKUI::ScrollBar::DefaultInteractionAnimator(&parentWidgetForDelete);
            animatorOnHeap->bindWidget(&scrollBar);
            delete animatorOnHeap;
        }

    }
    void testTabWidgetAnimator(){
        // 测试构造函数
        QWidget *parentWidget = new QWidget();
        UKUI::TabWidget::DefaultSlideAnimator animator(parentWidget);

        QTabWidget *tabWidget = new QTabWidget();
        tabWidget->addTab(new QWidget, "Tab 1");
        tabWidget->addTab(new QWidget, "Tab 2");
        QWidget parentWidgetForDelete;
        UKUI::TabWidget::DefaultSlideAnimator* animatorOnHeap = new UKUI::TabWidget::DefaultSlideAnimator(&parentWidgetForDelete);
        animatorOnHeap->bindTabWidget(tabWidget);
        delete animatorOnHeap;
        // 模拟触发currentChanged信号来执行相关逻辑（简单触发，未细致验证逻辑结果）
        QObject::connect(tabWidget, &QTabWidget::currentChanged, [](int) {});

        // 测试unboundTabWidget函数
        animator.unboundTabWidget();

        // 重新绑定进行多次操作测试
        animator.bindTabWidget(tabWidget);

        QEvent event(QEvent::None);
        animator.eventFilter(tabWidget, &event);
        animator.eventFilter(tabWidget->widget(0), &event);
        animator.eventFilter(tabWidget->widget(1), &event);


//         析构函数测试（通过对象生命周期结束自动调用析构函数来间接验证资源释放）
        {
            QWidget parentWidgetForDelete;
            UKUI::TabWidget::DefaultSlideAnimator* animatorOnHeap = new UKUI::TabWidget::DefaultSlideAnimator(&parentWidgetForDelete);
            animatorOnHeap->bindTabWidget(tabWidget);
            delete animatorOnHeap;
        }
    }

    void testUnpolish()
    {
        UKUIConfigStyle style("testUnpolish Style");;
        QWidget widget;
        style.unpolish(&widget);
        // 这里可以添加对初始状态的验证，例如检查某些属性是否已被正确设置或移除

        // 测试普通 QWidget 的 unpolish 操作
        QWidget testWidget;
        style.unpolish(&testWidget);
//         验证一些属性是否被正确移除或修改，例如事件过滤器是否已移除
//        QVERIFY(!testWidget.eventFilter(nullptr, nullptr));

        // 测试不同类型的部件
        QLabel label;
        style.unpolish(&label);
//        QVERIFY(!label.wordWrap());

        QMenu menu;
        style.unpolish(&menu);
        // 可以根据具体的实现添加更多的验证逻辑

        QTabWidget tabWidget;
        style.unpolish(&tabWidget);
        // 验证 tabWidget 相关的动画助手是否正确注销
        // 这里假设你有相应的方法来检查 m_tab_animation_helper 是否注销
        // 例如，通过检查内部状态或调用某些辅助函数来确认

        QScrollBar scrollBar;
        style.unpolish(&scrollBar);
        // 验证 scrollBar 相关的动画助手是否正确注销

        QListView itemView;
        style.unpolish(&itemView);
        // 验证 itemView 的视口属性是否已正确设置
//        QVERIFY(itemView.viewport()->testAttribute(Qt::WA_Hover));

        QToolButton toolButton;
        style.unpolish(&toolButton);
        // 验证 toolButton 相关的动画助手是否正确注销

        QPushButton pushButton;
        style.unpolish(&pushButton);
        // 验证 pushButton 相关的动画助手是否正确注销

        QComboBox comboBox;
        style.unpolish(&comboBox);
        // 验证 comboBox 相关的动画助手是否正确注销

        QSpinBox spinBox;
        style.unpolish(&spinBox);
        // 验证 spinBox 相关的动画助手是否正确注销

        QDoubleSpinBox doubleSpinBox;
        style.unpolish(&doubleSpinBox);
        // 验证 doubleSpinBox 相关的动画助手是否正确注销

        QRadioButton radioButton;
        style.unpolish(&radioButton);
        // 验证 radioButton 相关的动画助手是否正确注销

        QCheckBox checkBox;
        style.unpolish(&checkBox);
        // 验证 checkBox 相关的动画助手是否正确注销

        QSlider slider;
        style.unpolish(&slider);
        // 验证 slider 相关的动画助手是否正确注销

        QLineEdit lineEdit;
        style.unpolish(&lineEdit);
        // 验证 lineEdit 的属性是否已正确设置
//        QVERIFY(!lineEdit.testAttribute(Qt::WA_Hover));

        QTreeView treeView;
        style.unpolish(&treeView);
        // 验证 treeView 相关的动画助手是否正确注销

        // 测试窗口部件的各种属性组合
        QWidget windowWidget;
        windowWidget.setWindowFlags(Qt::Window);
        windowWidget.setProperty("useStyleWindowManager", true);
        style.unpolish(&windowWidget);
        // 验证窗口部件的窗口管理器是否正确注销

        QWidget translucentWidget;
        translucentWidget.setWindowFlags(Qt::Window);
        translucentWidget.setAttribute(Qt::WA_TranslucentBackground, true);
        style.unpolish(&translucentWidget);
        // 验证具有半透明背景的窗口部件的处理是否正确

        // 测试 QTipLabel 相关逻辑
        QWidget tipLabel;
        style.unpolish(&tipLabel);
        // 可以根据具体的实现添加相应的验证

        // 测试属性 "useStyleWindowManager" 不同情况的处理
        QWidget customWidget;
        customWidget.setWindowFlags(Qt::Window);
        customWidget.setProperty("useStyleWindowManager", false);
        style.unpolish(&customWidget);
        // 验证不同属性值下的处理是否正确

        // 测试各种部件的继承关系
        QWidget derivedWidget;
        derivedWidget.setWindowFlags(Qt::Window);
        derivedWidget.inherits("QPushButton");
        style.unpolish(&derivedWidget);
        // 验证继承关系的处理是否正确

        // 测试不同应用名称下的逻辑
        qApp->setApplicationName("ukui-menu");
        QWidget menuWidget;
        style.unpolish(&menuWidget);
        // 验证 ukui-menu 应用名称下的处理是否正确


        qApp->setApplicationName("other-app");
        QWidget otherWidget;
        style.unpolish(&otherWidget);
        // 验证其他应用名称下的处理是否正确

    }
    void testGestureHelper()
    {
        // 创建 GestureHelper 实例
        GestureHelper gestureHelper;
        // 创建 QWidget 实例
        QWidget widget;
        // 测试 registerWidget 函数
        gestureHelper.registerWidget(&widget);


        // 测试 ActivationChange 事件
        QEvent activationChangeEvent(QEvent::ActivationChange);
        gestureHelper.eventFilter(&widget, &activationChangeEvent);


        // 测试 TouchBegin 事件
        QTouchEvent touchBeginEvent(QEvent::TouchBegin);
        gestureHelper.eventFilter(&widget, &touchBeginEvent);


        // 模拟 TouchBegin 事件中的一些操作
        QList<QTouchEvent::TouchPoint> touchPoints;
        QTouchEvent::TouchPoint touchPoint1;
        touchPoint1.setPos(QPointF(10, 10));
        touchPoints.append(touchPoint1);
        auto teBegin = static_cast<QTouchEvent *>(&touchBeginEvent);
        teBegin->setTouchPoints(touchPoints);


        // 测试 TouchUpdate 事件
        QTouchEvent touchUpdateEvent(QEvent::TouchUpdate);
        gestureHelper.eventFilter(&widget, &touchUpdateEvent);


        // 模拟 TouchUpdate 事件中的一些操作
        QTouchEvent::TouchPoint touchPoint2;
        touchPoint2.setPos(QPointF(20, 20));
        touchPoints.append(touchPoint2);
        auto teUpdate = static_cast<QTouchEvent *>(&touchUpdateEvent);
        teUpdate->setTouchPoints(touchPoints);


        // 测试 TouchCancel 事件
        QTouchEvent touchCancelEvent(QEvent::TouchCancel);
        gestureHelper.eventFilter(&widget, &touchCancelEvent);


        // 测试 TouchEnd 事件
        QTouchEvent touchEndEvent(QEvent::TouchEnd);
        gestureHelper.eventFilter(&widget, &touchEndEvent);


//        // 测试 Gesture 事件
//        QGestureEvent gestureEvent(QEvent::Gesture);


//        // 模拟 TwoFingerSlideGesture
        UKUI::TwoFingerSlideGesture twoFingerSlideGesture;
//        gestureEvent.addGesture(&twoFingerSlideGesture);


//        // 模拟 TwoFingerSlideGesture 的更新状态
//        twoFingerSlideGesture.setState(Qt::GestureUpdated);
//        gestureHelper.eventFilter(&widget, &gestureEvent);


//        // 模拟没有 Scroller 的情况
//        QWidget widgetWithoutScroller;
//        gestureHelper.eventFilter(&widgetWithoutScroller, &gestureEvent);


//        // 模拟 TwoFingerZoomGesture
        UKUI::TwoFingerZoomGesture twoFingerZoomGesture;
//        gestureEvent.addGesture(&twoFingerZoomGesture);


//        // 模拟 TwoFingerZoomGesture 的不同缩放方向
//        twoFingerZoomGesture.setZoomDirection(UKUI::TwoFingerZoomGesture::ZoomIn);
//        gestureHelper.eventFilter(&widget, &gestureEvent);


//        twoFingerZoomGesture.setZoomDirection(UKUI::TwoFingerZoomGesture::ZoomOut);
//        gestureHelper.eventFilter(&widget, &gestureEvent);


//        // 模拟 TapGesture
        QTapGesture tapGesture;
//        gestureEvent.addGesture(&tapGesture);


//        // 模拟 TapGesture 的不同状态
//        tapGesture.setState(Qt::GestureStarted);
//        gestureHelper.eventFilter(&widget, &gestureEvent);


//        tapGesture.setState(Qt::GestureCanceled);
//        gestureHelper.eventFilter(&widget, &gestureEvent);


//        tapGesture.setState(Qt::GestureFinished);
//        gestureHelper.eventFilter(&widget, &gestureEvent);


//        // 模拟 TapAndHoldGesture
        QTapAndHoldGesture tapAndHoldGesture;
//        gestureEvent.addGesture(&tapAndHoldGesture);


//        // 模拟 TapAndHoldGesture 的不同状态
//        tapAndHoldGesture.setState(Qt::GestureStarted);
//        gestureHelper.eventFilter(&widget, &gestureEvent);


//        tapAndHoldGesture.setState(Qt::GestureCanceled);
//        gestureHelper.eventFilter(&widget, &gestureEvent);


//        tapAndHoldGesture.setState(Qt::GestureFinished);
//        gestureHelper.eventFilter(&widget, &gestureEvent);


//        // 模拟 SwipeGesture
        QSwipeGesture swipeGesture;
//        gestureEvent.addGesture(&swipeGesture);
//        gestureHelper.eventFilter(&widget, &gestureEvent);


//        // 模拟 PanGesture
        QPanGesture panGesture;
//        gestureEvent.addGesture(&panGesture);


//        // 模拟 PanGesture 的不同状态
//        panGesture.setState(Qt::GestureStarted);
//        gestureHelper.eventFilter(&widget, &gestureEvent);


//        panGesture.setState(Qt::GestureCanceled);
//        gestureHelper.eventFilter(&widget, &gestureEvent);


//        panGesture.setState(Qt::GestureFinished);
//        gestureHelper.eventFilter(&widget, &gestureEvent);


        // 测试 MouseMove 事件
        QMouseEvent mouseMoveEvent(QEvent::MouseMove, QPoint(10, 10), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
        gestureHelper.eventFilter(&widget, &mouseMoveEvent);


        // 测试 MouseButtonPress 事件
        QMouseEvent mouseButtonPressEvent(QEvent::MouseButtonPress, QPoint(10, 10), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
        gestureHelper.eventFilter(&widget, &mouseButtonPressEvent);


        // 测试 MouseButtonRelease 事件
        QMouseEvent mouseButtonReleaseEvent(QEvent::MouseButtonRelease, QPoint(10, 10), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
        gestureHelper.eventFilter(&widget, &mouseButtonReleaseEvent);


        // 测试 DragEnter 和 DragMove 事件
        QEvent dragEnterEvent(QEvent::DragEnter);
        gestureHelper.eventFilter(&widget, &dragEnterEvent);


        QEvent dragMoveEvent(QEvent::DragMove);
        gestureHelper.eventFilter(&widget, &dragMoveEvent);


        // 测试 unregisterWidget 函数
        gestureHelper.unregisterWidget(&widget);
    }
    void testPushButton(){
        QWidget *w = new QWidget();
        QVBoxLayout *layout = new QVBoxLayout();
        QPushButton *pushbutton = new QPushButton();
        QToolButton *tb = new QToolButton();
        QCheckBox *box = new QCheckBox();
        QScrollBar *scrollbar1 = new QScrollBar(Qt::Vertical);
        scrollbar1->setObjectName("scrollbar1111");
        scrollbar1->setContextMenuPolicy(Qt::NoContextMenu);
        qDebug() << "scrollbar1..." << scrollbar1->minimum() << scrollbar1->maximum();
        scrollbar1->setProperty("drawScrollBarGroove", false);
        scrollbar1->setProperty("needTranslucent", true);

        QScrollBar *scrollbar2 = new QScrollBar(Qt::Horizontal);
        scrollbar2->setProperty("needTranslucent", false);
        scrollbar2->setObjectName("scrollbar22222");
        scrollbar2->setPageStep(1);
        scrollbar2->setMaximum(100);
        scrollbar2->setMinimum(0);

        QSlider *slider2 = new QSlider(Qt::Horizontal);
        slider2->setObjectName("slider2");

        slider2->setMaximum(100);
        slider2->setMinimum(0);
    //    slider2->setSingleStep(1);
        slider2->setPageStep(10);
        slider2->setTickPosition(QSlider::TicksBelow);
        slider2->setProperty("needTranslucent", true);


        layout->addWidget(pushbutton);
        layout->addWidget(tb);
        layout->addWidget(scrollbar1);
        layout->addWidget(scrollbar2);
        layout->addWidget(slider2);

        w->setLayout(layout);
        w->show();
    }
    void ConfigSliderAnimatorTests()
    {
        QSlider widget;
        UKUIConfigStyleSpace::ConfigSliderAnimator animator;

        // 测试 bindWidget 函数
        animator.bindWidget(&widget);

        // 测试 setAnimatorStartValue 函数
        animator.setAnimatorStartValue("slider_opacity", 0.0);
        animator.setAnimatorStartValue("additional_opacity", 0.0);
        animator.setAnimatorStartValue("move_position", 0.0);
        animator.setAnimatorStartValue("bg_width", 0.0);

        // 测试 setAnimatorEndValue 函数
        animator.setAnimatorEndValue("slider_opacity", 1.0);
        animator.setAnimatorEndValue("additional_opacity", 0.1);
        animator.setAnimatorEndValue("move_position", 1.0);
        animator.setAnimatorEndValue("bg_width", 1.0);

        // 测试 setAnimatorDuration 函数
        animator.setAnimatorDuration("slider_opacity", 200);
        animator.setAnimatorDuration("additional_opacity", 150);
        animator.setAnimatorDuration("move_position", 150);
        animator.setAnimatorDuration("bg_width", 200);

        // 测试 setAnimatorDirectionForward 函数
        animator.setAnimatorDirectionForward("slider_opacity", true);
        animator.setAnimatorDirectionForward("additional_opacity", false);
        animator.setAnimatorDirectionForward("move_position", true);
        animator.setAnimatorDirectionForward("bg_width", false);

        // 测试 startAnimator 函数
        animator.startAnimator("slider_opacity");
        animator.startAnimator("additional_opacity");
        animator.startAnimator("move_position");
        animator.startAnimator("bg_width");

        // 等待一段时间让动画运行
        QApplication::processEvents();
        QThread::msleep(250);

        // 测试 value 函数
        qDebug() << "slider_opacity value: " << animator.value("slider_opacity");
        qDebug() << "additional_opacity value: " << animator.value("additional_opacity");
        qDebug() << "move_position value: " << animator.value("move_position");
        qDebug() << "bg_width value: " << animator.value("bg_width");

        // 测试 animatorStartValue 函数
        qDebug() << "slider_opacity start value: " << animator.animatorStartValue("slider_opacity");
        qDebug() << "additional_opacity start value: " << animator.animatorStartValue("additional_opacity");
        qDebug() << "move_position start value: " << animator.animatorStartValue("move_position");
        qDebug() << "bg_width start value: " << animator.animatorStartValue("bg_width");

        // 测试 animatorEndValue 函数
        qDebug() << "slider_opacity end value: " << animator.animatorEndValue("slider_opacity");
        qDebug() << "additional_opacity end value: " << animator.animatorEndValue("additional_opacity");
        qDebug() << "move_position end value: " << animator.animatorEndValue("move_position");
        qDebug() << "bg_width end value: " << animator.animatorEndValue("bg_width");

        // 测试 isRunning 函数
        qDebug() << "slider_opacity is running: " << animator.isRunning("slider_opacity");
        qDebug() << "additional_opacity is running: " << animator.isRunning("additional_opacity");
        qDebug() << "move_position is running: " << animator.isRunning("move_position");
        qDebug() << "bg_width is running: " << animator.isRunning("bg_width");

        // 测试 currentAnimatorTime 函数
        qDebug() << "slider_opacity current time: " << animator.currentAnimatorTime("slider_opacity");
        qDebug() << "additional_opacity current time: " << animator.currentAnimatorTime("additional_opacity");
        qDebug() << "move_position current time: " << animator.currentAnimatorTime("move_position");
        qDebug() << "bg_width current time: " << animator.currentAnimatorTime("bg_width");

        // 测试 totalAnimationDuration 函数
        qDebug() << "slider_opacity total duration: " << animator.totalAnimationDuration("slider_opacity");
        qDebug() << "additional_opacity total duration: " << animator.totalAnimationDuration("additional_opacity");
        qDebug() << "move_position total duration: " << animator.totalAnimationDuration("move_position");
        qDebug() << "bg_width total duration: " << animator.totalAnimationDuration("bg_width");

        // 测试 setExtraProperty 函数
        animator.setExtraProperty("end_position", 100);
        animator.setExtraProperty("start_position", 50);
        animator.setExtraProperty("addValue", true);

        // 测试 getExtraProperty 函数
        qDebug() << "end_position: " << animator.getExtraProperty("end_position");
        qDebug() << "start_position: " << animator.getExtraProperty("start_position");
        qDebug() << "addValue: " << animator.getExtraProperty("addValue");

        // 测试 stopAnimator 函数
        animator.stopAnimator("slider_opacity");
        animator.stopAnimator("additional_opacity");
        animator.stopAnimator("move_position");
        animator.stopAnimator("bg_width");

        // 测试 unboundWidget 函数
        animator.unboundWidget();
    }

    void runConfigBoxAnimatorTests()
    {
        QComboBox comboBox;
        UKUIConfigStyleSpace::ConfigBoxAnimator animator;

        // 测试 bindWidget 函数
        bool bindResult = animator.bindWidget(&comboBox);
        qDebug() << "bindWidget result: " << bindResult;
        if (bindResult) {
            // 测试 setAnimatorStartValue 函数
            animator.setAnimatorStartValue("MouseOver", 0.2);
            animator.setAnimatorStartValue("SunKen", 0.3);

            // 测试 setAnimatorEndValue 函数
            animator.setAnimatorEndValue("MouseOver", 0.8);
            animator.setAnimatorEndValue("SunKen", 0.7);

            // 测试 setAnimatorDuration 函数
            animator.setAnimatorDuration("MouseOver", 150);
            animator.setAnimatorDuration("SunKen", 120);

            // 测试 setAnimatorDirectionForward 函数
            animator.setAnimatorDirectionForward("MouseOver", true);
            animator.setAnimatorDirectionForward("SunKen", false);

            // 测试 startAnimator 函数
            animator.startAnimator("MouseOver");
            animator.startAnimator("SunKen");

            // 等待一段时间让动画运行
            QApplication::processEvents();
            QThread::msleep(100);

            // 测试 value 函数
            qDebug() << "MouseOver value: " << animator.value("MouseOver");
            qDebug() << "SunKen value: " << animator.value("SunKen");

            // 测试 isRunning 函数
            qDebug() << "MouseOver is running: " << animator.isRunning("MouseOver");
            qDebug() << "SunKen is running: " << animator.isRunning("SunKen");

            // 测试 currentAnimatorTime 函数
            qDebug() << "MouseOver current time: " << animator.currentAnimatorTime("MouseOver");
            qDebug() << "SunKen current time: " << animator.currentAnimatorTime("SunKen");

            // 测试 totalAnimationDuration 函数
            qDebug() << "MouseOver total duration: " << animator.totalAnimationDuration("MouseOver");
            qDebug() << "SunKen total duration: " << animator.totalAnimationDuration("SunKen");

            // 测试 stopAnimator 函数
            animator.stopAnimator("MouseOver");
            animator.stopAnimator("SunKen");
        }

        // 测试 unboundWidget 函数
        bool unboundResult = animator.unboundWidget();
        qDebug() << "unboundWidget result: " << unboundResult;
    }
    void runConfigButtonAnimatorTests()
    {
        // 创建各种可能的按钮类型
        QToolButton toolButton;
        QPushButton pushButton;
        QComboBox comboBox;
        QSpinBox spinBox;
        QDoubleSpinBox doubleSpinBox;

        UKUIConfigStyleSpace::ConfigButtonAnimator animator;

        // 测试 bindWidget 函数
        bool bindResult;

        // 测试 QToolButton
        bindResult = animator.bindWidget(&toolButton);
        qDebug() << "bindWidget for QToolButton result: " << bindResult;
        if (bindResult) {
            // 调用各种函数进行测试
            testAnimatorFunctions(animator);
            animator.unboundWidget();
        }

        // 测试 QPushButton
        bindResult = animator.bindWidget(&pushButton);
        qDebug() << "bindWidget for QPushButton result: " << bindResult;
        if (bindResult) {
            testAnimatorFunctions(animator);
            animator.unboundWidget();
        }

        // 测试 QComboBox
        bindResult = animator.bindWidget(&comboBox);
        qDebug() << "bindWidget for QComboBox result: " << bindResult;
        if (bindResult) {
            testAnimatorFunctions(animator);
            animator.unboundWidget();
        }

        // 测试 QSpinBox
        bindResult = animator.bindWidget(&spinBox);
        qDebug() << "bindWidget for QSpinBox result: " << bindResult;
        if (bindResult) {
            testAnimatorFunctions(animator);
            animator.unboundWidget();
        }

        // 测试 QDoubleSpinBox
        bindResult = animator.bindWidget(&doubleSpinBox);
        qDebug() << "bindWidget for QDoubleSpinBox result: " << bindResult;
        if (bindResult) {
            testAnimatorFunctions(animator);
            animator.unboundWidget();
        }
    }

    // 封装一个测试动画器各种函数的函数
    void testAnimatorFunctions(UKUIConfigStyleSpace::ConfigButtonAnimator& animator) {
        // 测试 setAnimatorStartValue 函数
        animator.setAnimatorStartValue("MouseOver", 0.2);
        animator.setAnimatorStartValue("SunKen", 0.3);

        // 测试 setAnimatorEndValue 函数
        animator.setAnimatorEndValue("MouseOver", 0.8);
        animator.setAnimatorEndValue("SunKen", 0.7);

        // 测试 setAnimatorDuration 函数
        animator.setAnimatorDuration("MouseOver", 150);
        animator.setAnimatorDuration("SunKen", 120);

        // 测试 setAnimatorDirectionForward 函数
        animator.setAnimatorDirectionForward("MouseOver", true);
        animator.setAnimatorDirectionForward("SunKen", false);

        // 测试 startAnimator 函数
        animator.startAnimator("MouseOver");
        animator.startAnimator("SunKen");

        // 等待一段时间让动画运行
        QApplication::processEvents();
        QThread::msleep(100);

        // 测试 value 函数
        qDebug() << "MouseOver value: " << animator.value("MouseOver");
        qDebug() << "SunKen value: " << animator.value("SunKen");

        // 测试 isRunning 函数
        qDebug() << "MouseOver is running: " << animator.isRunning("MouseOver");
        qDebug() << "SunKen is running: " << animator.isRunning("SunKen");

        // 测试 currentAnimatorTime 函数
        qDebug() << "MouseOver current time: " << animator.currentAnimatorTime("MouseOver");
        qDebug() << "SunKen current time: " << animator.currentAnimatorTime("SunKen");

        // 测试 totalAnimationDuration 函数
        qDebug() << "MouseOver total duration: " << animator.totalAnimationDuration("MouseOver");
        qDebug() << "SunKen total duration: " << animator.totalAnimationDuration("SunKen");

        // 测试 endValue 函数
        qDebug() << "MouseOver end value: " << animator.endValue("MouseOver");
        qDebug() << "SunKen end value: " << animator.endValue("SunKen");

        // 测试 stopAnimator 函数
        animator.stopAnimator("MouseOver");
        animator.stopAnimator("SunKen");
    }

    void runConfigCheckBoxAnimatorTests()
    {
        QCheckBox checkBox;
        UKUIConfigStyleSpace::ConfigCheckBoxAnimator animator;

        // 测试 bindWidget 函数
        bool bindResult = animator.bindWidget(&checkBox);
        qDebug() << "bindWidget result: " << bindResult;
        if (bindResult) {
            // 测试 setAnimatorStartValue 函数
            animator.setAnimatorStartValue("OnScale", 0.2);
            animator.setAnimatorStartValue("OnOpacity", 0.3);
            animator.setAnimatorStartValue("OnBase", 0.4);
            animator.setAnimatorStartValue("Off", 0.5);

            // 测试 setAnimatorEndValue 函数
            animator.setAnimatorEndValue("OnScale", 0.8);
            animator.setAnimatorEndValue("OnOpacity", 0.7);
            animator.setAnimatorEndValue("OnBase", 0.6);
            animator.setAnimatorEndValue("Off", 0.5);

            // 测试 setAnimatorDuration 函数
            animator.setAnimatorDuration("OnScale", 300);
            animator.setAnimatorDuration("OnOpacity", 200);
            animator.setAnimatorDuration("OnBase", 250);
            animator.setAnimatorDuration("Off", 150);

            // 测试 setAnimatorDirectionForward 函数
            animator.setAnimatorDirectionForward("OnScale", true);
            animator.setAnimatorDirectionForward("OnOpacity", false);
            animator.setAnimatorDirectionForward("OnBase", true);
            animator.setAnimatorDirectionForward("Off", false);

            // 测试 startAnimator 函数
            animator.startAnimator("OnScale");
            animator.startAnimator("OnOpacity");
            animator.startAnimator("OnBase");
            animator.startAnimator("Off");

            // 等待一段时间让动画运行
            QApplication::processEvents();
            QThread::msleep(200);

            // 测试 value 函数
            qDebug() << "OnScale value: " << animator.value("OnScale");
            qDebug() << "OnOpacity value: " << animator.value("OnOpacity");
            qDebug() << "OnBase value: " << animator.value("OnBase");
            qDebug() << "Off value: " << animator.value("Off");

            // 测试 isRunning 函数
            qDebug() << "OnScale is running: " << animator.isRunning("OnScale");
            qDebug() << "OnOpacity is running: " << animator.isRunning("OnOpacity");
            qDebug() << "OnBase is running: " << animator.isRunning("OnBase");
            qDebug() << "Off is running: " << animator.isRunning("Off");

            // 测试 currentAnimatorTime 函数
            qDebug() << "OnScale current time: " << animator.currentAnimatorTime("OnScale");
            qDebug() << "OnOpacity current time: " << animator.currentAnimatorTime("OnOpacity");
            qDebug() << "OnBase current time: " << animator.currentAnimatorTime("OnBase");
            qDebug() << "Off current time: " << animator.currentAnimatorTime("Off");

            // 测试 totalAnimationDuration 函数
            qDebug() << "OnScale total duration: " << animator.totalAnimationDuration("OnScale");
            qDebug() << "OnOpacity total duration: " << animator.totalAnimationDuration("OnOpacity");
            qDebug() << "OnBase total duration: " << animator.totalAnimationDuration("OnBase");
            qDebug() << "Off total duration: " << animator.totalAnimationDuration("Off");

            // 测试 setExtraProperty 函数
            animator.setExtraProperty("nochange", true);
            qDebug() << "nochange value: " << animator.getExtraProperty("nochange");

            // 测试 stopAnimator 函数
            animator.stopAnimator("OnScale");
            animator.stopAnimator("OnOpacity");
            animator.stopAnimator("OnBase");
            animator.stopAnimator("Off");
        }

        // 测试 unboundWidget 函数
        bool unboundResult = animator.unboundWidget();
        qDebug() << "unboundWidget result: " << unboundResult;
    }
    void runConfigProgressBarAnimationTests()
    {
        QProgressBar progressBar;
        UKUIConfigStyleSpace::ConfigProgressBarAnimation animator(&progressBar);

        // 测试 init 函数
        qDebug() << "Duration: " << animator.duration();
        qDebug() << "Start value: " << animator.startValue();
        qDebug() << "End value: " << animator.endValue();
        qDebug() << "Direction: " << animator.direction();
        qDebug() << "Easing curve: " << animator.easingCurve();


        // 测试 target 函数
        QWidget *targetWidget = animator.target();
        qDebug() << "Target widget: " << targetWidget;


        // 测试 valueChanged 和 finished 信号连接
        animator.start();
        QApplication::processEvents();
        QThread::msleep(500);


        // 测试修改动画参数
        animator.setStartValue(0.2);
        animator.setEndValue(0.8);
        animator.setDuration(3000);
        animator.setDirection(QAbstractAnimation::Backward);
        animator.setEasingCurve(QEasingCurve::OutCubic);


        // 再次测试参数是否修改成功
        qDebug() << "Modified Duration: " << animator.duration();
        qDebug() << "Modified Start value: " << animator.startValue();
        qDebug() << "Modified End value: " << animator.endValue();
        qDebug() << "Modified Direction: " << animator.direction();
        qDebug() << "Modified Easing curve: " << animator.easingCurve();


        // 重新启动动画以查看修改后的效果
        animator.start();
        QApplication::processEvents();
        QThread::msleep(500);


        // 测试暂停和恢复动画
//        animator.pause();
//        qDebug() << "Is paused: " << animator.state() == QAbstractAnimation::Paused;
//        animator.resume();
//        qDebug() << "Is resumed: " << animator.state() == QAbstractAnimation::Running;


//        // 测试停止动画
//        animator.stop();
//        qDebug() << "Is stopped: " << animator.state() == QAbstractAnimation::Stopped;


        // 测试当前时间和总时长
        qDebug() << "Current time: " << animator.currentTime();
        qDebug() << "Total duration: " << animator.totalDuration();
    }
    void runConfigRadioButtonAnimatorTests()
    {
        QRadioButton radioButton;
        UKUIConfigStyleSpace::ConfigRadioButtonAnimator animator;

        // 测试 bindWidget 函数
        bool bindResult = animator.bindWidget(&radioButton);
        qDebug() << "bindWidget result: " << bindResult;
        if (bindResult) {
            // 测试 setAnimatorStartValue 函数
            animator.setAnimatorStartValue("SunKenOn", 0.2);
            animator.setAnimatorStartValue("Off", 0.8);

            // 测试 setAnimatorEndValue 函数
            animator.setAnimatorEndValue("SunKenOn", 0.8);
            animator.setAnimatorEndValue("Off", 0.2);

            // 测试 setAnimatorDuration 函数
            animator.setAnimatorDuration("SunKenOn", 300);
            animator.setAnimatorDuration("Off", 150);

            // 测试 setAnimatorDirectionForward 函数
            animator.setAnimatorDirectionForward("SunKenOn", true);
            animator.setAnimatorDirectionForward("Off", false);

            // 测试 startAnimator 函数
            animator.startAnimator("SunKenOn");
            animator.startAnimator("Off");

            // 等待一段时间让动画运行
            QApplication::processEvents();
            QThread::msleep(200);

            // 测试 value 函数
            qDebug() << "SunKenOn value: " << animator.value("SunKenOn");
            qDebug() << "Off value: " << animator.value("Off");

            // 测试 isRunning 函数
            qDebug() << "SunKenOn is running: " << animator.isRunning("SunKenOn");
            qDebug() << "Off is running: " << animator.isRunning("Off");

            // 测试 currentAnimatorTime 函数
            qDebug() << "SunKenOn current time: " << animator.currentAnimatorTime("SunKenOn");
            qDebug() << "Off current time: " << animator.currentAnimatorTime("Off");

            // 测试 totalAnimationDuration 函数
            qDebug() << "SunKenOn total duration: " << animator.totalAnimationDuration("SunKenOn");
            qDebug() << "Off total duration: " << animator.totalAnimationDuration("Off");

            // 测试 stopAnimator 函数
            animator.stopAnimator("SunKenOn");
            animator.stopAnimator("Off");
        }

        // 测试 unboundWidget 函数
        bool unboundResult = animator.unboundWidget();
        qDebug() << "unboundWidget result: " << unboundResult;
    }
    void runConfigTreeAnimatorTests()
    {
        QTreeView treeView;
        UKUIConfigStyleSpace::ConfigTreeAnimator animator;

        // 测试 bindWidget 函数
        bool bindResult = animator.bindWidget(&treeView);
        qDebug() << "bindWidget result: " << bindResult;
        if (bindResult) {
            // 测试 setAnimatorStartValue 函数
            animator.setAnimatorStartValue("expand", 0.2);
            animator.setAnimatorStartValue("collaps", 0.3);

            // 测试 setAnimatorEndValue 函数
            animator.setAnimatorEndValue("expand", 0.8);
            animator.setAnimatorEndValue("collaps", 0.7);

            // 测试 setAnimatorDuration 函数
            animator.setAnimatorDuration("expand", 300);
            animator.setAnimatorDuration("collaps", 250);

            // 测试 setAnimatorDirectionForward 函数
            animator.setAnimatorDirectionForward("expand", true);
            animator.setAnimatorDirectionForward("collaps", false);

            // 测试 startAnimator 函数
            animator.startAnimator("expand");
            animator.startAnimator("collaps");

            // 等待一段时间让动画运行
            QApplication::processEvents();
            QThread::msleep(200);

            // 测试 value 函数
            qDebug() << "expand value: " << animator.value("expand");
            qDebug() << "collaps value: " << animator.value("collaps");

            // 测试 isRunning 函数
            qDebug() << "expand is running: " << animator.isRunning("expand");
            qDebug() << "collaps is running: " << animator.isRunning("collaps");

            // 测试 currentAnimatorTime 函数
            qDebug() << "expand current time: " << animator.currentAnimatorTime("expand");
            qDebug() << "collaps current time: " << animator.currentAnimatorTime("collaps");

            // 测试 totalAnimationDuration 函数
            qDebug() << "expand total duration: " << animator.totalAnimationDuration("expand");
            qDebug() << "collaps total duration: " << animator.totalAnimationDuration("collaps");

            // 测试 animatorStartValue 函数
            qDebug() << "expand start value: " << animator.animatorStartValue("expand");
            qDebug() << "collaps start value: " << animator.animatorStartValue("collaps");

            // 测试 animatorEndValue 函数
            qDebug() << "expand end value: " << animator.animatorEndValue("expand");
            qDebug() << "collaps end value: " << animator.animatorEndValue("collaps");

            // 测试 stopAnimator 函数
            animator.stopAnimator("expand");
            animator.stopAnimator("collaps");

            // 测试 setExtraProperty 函数
            QModelIndex index1, index2;
            animator.setExtraProperty("expandItem", index1);
            animator.setExtraProperty("collapsItem", index2);

            // 测试 getExtraProperty 函数
            qDebug() << "expandItem: " << animator.getExtraProperty("expandItem");
            qDebug() << "collapsItem: " << animator.getExtraProperty("collapsItem");
        }

        // 测试 unboundWidget 函数
        bool unboundResult = animator.unboundWidget();
        qDebug() << "unboundWidget result: " << unboundResult;
    }


    void runUKUIConfigStyleDrawControlTests()
    {
        QWidget widget;
        UKUIConfigStyle style("testDrawControlStyle");

        // 获取系统自带图标
        QIcon systemIcon = QIcon::fromTheme("application-x-desktop");
        QPixmap icon = systemIcon.pixmap(QSize(16, 16)); // 可以根据需要调整图标的大小


        // 测试 CE_PushButton
        {
            QStyleOptionButton buttonOption;
            buttonOption.state = QStyle::State_Enabled | QStyle::State_Raised;
            buttonOption.text = "Test Button";
            buttonOption.icon = systemIcon;
            QImage image(200, 50, QImage::Format_ARGB32);
            image.fill(Qt::transparent);
            QPainter imagePainter(&image);
            style.drawControl(QStyle::CE_PushButton, &buttonOption, &imagePainter, &widget);
        }


        // 测试 CE_ScrollBarAddLine
        {
            QStyleOptionSlider sliderOption;
            sliderOption.orientation = Qt::Horizontal;
            sliderOption.state = QStyle::State_Enabled | QStyle::State_MouseOver;
            sliderOption.minimum = 0;
            sliderOption.maximum = 100;
//            sliderOption.icon = systemIcon;
            QImage image(200, 20, QImage::Format_ARGB32);
            image.fill(Qt::transparent);
            QPainter imagePainter(&image);
            style.drawControl(QStyle::CE_ScrollBarAddLine, &sliderOption, &imagePainter, &widget);
        }


        // 测试 CE_ScrollBarSubLine
        {
            QStyleOptionSlider sliderOption;
            sliderOption.orientation = Qt::Horizontal;
            sliderOption.state = QStyle::State_Enabled | QStyle::State_MouseOver;
            sliderOption.minimum = 0;
            sliderOption.maximum = 100;
//            sliderOption.icon = systemIcon;
            QImage image(200, 20, QImage::Format_ARGB32);
            image.fill(Qt::transparent);
            QPainter imagePainter(&image);
            style.drawControl(QStyle::CE_ScrollBarSubLine, &sliderOption, &imagePainter, &widget);
        }


        // 测试 CE_ScrollBarSlider
        {
            QStyleOptionSlider sliderOption;
            sliderOption.orientation = Qt::Horizontal;
            sliderOption.state = QStyle::State_Enabled | QStyle::State_MouseOver;
            sliderOption.minimum = 0;
            sliderOption.maximum = 100;
            sliderOption.sliderPosition = 50;
//            sliderOption.icon = systemIcon;
            QImage image(200, 20, QImage::Format_ARGB32);
            image.fill(Qt::transparent);
            QPainter imagePainter(&image);
            style.drawControl(QStyle::CE_ScrollBarSlider, &sliderOption, &imagePainter, &widget);
        }


        // 测试 CE_TabBarTabShape
        {
            QStyleOptionTab tabOption;
            tabOption.state = QStyle::State_Selected;
            tabOption.text = "Tab 1";
            tabOption.icon = systemIcon;
            QImage image(150, 30, QImage::Format_ARGB32);
            image.fill(Qt::transparent);
            QPainter imagePainter(&image);

            widget.setProperty("setRadius", 1);
            widget.setProperty("setWidgetBackgroundBrush", QBrush(QColor(Qt::red)));
            widget.setProperty("setTabBarBackgroundBrush", QBrush(QColor(Qt::red)));
            widget.setProperty("setTabBarDefaultBrush",    QBrush(QColor(Qt::red)));
            widget.setProperty("setTabBarHoverBrush",      QBrush(QColor(Qt::red)));
            widget.setProperty("setTabBarClickBrush",      QBrush(QColor(Qt::red)));
            widget.setProperty("setTabBarSelectBrush",     QBrush(QColor(Qt::red)));
            widget.setProperty("setTabBarDefaultPen",      QPen(QColor(Qt::red)));
            widget.setProperty("setTabBarFocusPen",        QPen(QColor(Qt::red)));
            widget.setProperty("setTabBarClickPen",        QPen(QColor(Qt::red)));
            widget.setProperty("setTabBarHoverPen",        QPen(QColor(Qt::red)));

            style.drawControl(QStyle::CE_TabBarTabShape, &tabOption, &imagePainter, &widget);
        }


        // 测试 CE_TabBarTabLabel
        {
            QStyleOptionTab tabOption;
            tabOption.state = QStyle::State_Selected;
            tabOption.text = "Tab 1";
            tabOption.icon = systemIcon;
            QImage image(150, 30, QImage::Format_ARGB32);
            image.fill(Qt::transparent);
            QPainter imagePainter(&image);
            style.drawControl(QStyle::CE_TabBarTabLabel, &tabOption, &imagePainter, &widget);
        }


        // 测试 CE_TabBarTab
        {
            QStyleOptionTab tabOption;
            tabOption.state = QStyle::State_Selected;
            tabOption.text = "Tab 1";
            tabOption.icon = systemIcon;
            QImage image(150, 30, QImage::Format_ARGB32);
            image.fill(Qt::transparent);
            QPainter imagePainter(&image);
            style.drawControl(QStyle::CE_TabBarTab, &tabOption, &imagePainter, &widget);
        }


        // 测试 CE_CheckBox
        {
            QStyleOptionButton checkBoxOption;
            checkBoxOption.state = QStyle::State_Enabled | QStyle::State_Selected;
            checkBoxOption.text = "Check Box";
            checkBoxOption.icon = systemIcon;
            QImage image(150, 30, QImage::Format_ARGB32);
            image.fill(Qt::transparent);
            QPainter imagePainter(&image);
            style.drawControl(QStyle::CE_CheckBox, &checkBoxOption, &imagePainter, &widget);
        }


        // 测试 CE_CheckBoxLabel
        {
            QStyleOptionButton checkBoxOption;
            checkBoxOption.state = QStyle::State_Enabled | QStyle::State_Selected;
            checkBoxOption.text = "Check Box Label";
            checkBoxOption.icon = systemIcon;
            QImage image(150, 30, QImage::Format_ARGB32);
            image.fill(Qt::transparent);
            QPainter imagePainter(&image);
            style.drawControl(QStyle::CE_CheckBoxLabel, &checkBoxOption, &imagePainter, &widget);
        }


        // 测试 CE_MenuBarItem
        {
            QStyleOptionMenuItem menuItemOption;
            menuItemOption.state = QStyle::State_Enabled | QStyle::State_Selected;
            menuItemOption.text = "Menu Bar Item";
            menuItemOption.icon = systemIcon;
            QImage image(200, 30, QImage::Format_ARGB32);
            image.fill(Qt::transparent);
            QPainter imagePainter(&image);
            style.drawControl(QStyle::CE_MenuBarItem, &menuItemOption, &imagePainter, &widget);
        }


        // 测试 CE_ToolBoxTabShape
        {
            QStyleOptionToolBox toolBoxOption;
            toolBoxOption.state = QStyle::State_Enabled | QStyle::State_Selected;
            toolBoxOption.text = "Tool Box Tab Shape";
            toolBoxOption.icon = systemIcon;
            QImage image(200, 30, QImage::Format_ARGB32);
            image.fill(Qt::transparent);
            QPainter imagePainter(&image);
            style.drawControl(QStyle::CE_ToolBoxTabShape, &toolBoxOption, &imagePainter, &widget);
        }


        // 测试 CE_ToolBoxTabLabel
        {
            QStyleOptionToolBox toolBoxOption;
            toolBoxOption.state = QStyle::State_Enabled | QStyle::State_Selected;
            toolBoxOption.text = "Tool Box Tab Label";
            toolBoxOption.icon = systemIcon;
            QImage image(200, 30, QImage::Format_ARGB32);
            image.fill(Qt::transparent);
            QPainter imagePainter(&image);
            style.drawControl(QStyle::CE_ToolBoxTabLabel, &toolBoxOption, &imagePainter, &widget);
        }


        // 测试 CE_ToolBoxTab
        {
            QStyleOptionToolBox toolBoxOption;
            toolBoxOption.state = QStyle::State_Enabled | QStyle::State_Selected;
            toolBoxOption.text = "Tool Box Tab";
            toolBoxOption.icon = systemIcon;
            QImage image(200, 30, QImage::Format_ARGB32);
            image.fill(Qt::transparent);
            QPainter imagePainter(&image);
            style.drawControl(QStyle::CE_ToolBoxTab, &toolBoxOption, &imagePainter, &widget);
        }


        // 测试 CE_ProgressBarGroove
        {
            QStyleOptionProgressBar progressBarOption;
            progressBarOption.minimum = 0;
            progressBarOption.maximum = 100;
            progressBarOption.progress = 50;
            progressBarOption.textVisible = true;
            progressBarOption.text = "50%";
//            progressBarOption.icon = systemIcon;
            QImage image(200, 30, QImage::Format_ARGB32);
            image.fill(Qt::transparent);
            QPainter imagePainter(&image);
            style.drawControl(QStyle::CE_ProgressBarGroove, &progressBarOption, &imagePainter, &widget);
        }


        // 测试 CE_ProgressBarContent
        {
            QStyleOptionProgressBar progressBarOption;
            progressBarOption.minimum = 0;
            progressBarOption.maximum = 100;
            progressBarOption.progress = 50;
            progressBarOption.textVisible = true;
            progressBarOption.text = "50%";
//            progressBarOption.icon = systemIcon;
            QImage image(200, 30, QImage::Format_ARGB32);
            image.fill(Qt::transparent);
            QPainter imagePainter(&image);
            style.drawControl(QStyle::CE_ProgressBarContents, &progressBarOption, &imagePainter, &widget);
        }


        // 测试 CE_ProgressBarLabel
        {
            QStyleOptionProgressBar progressBarOption;
            progressBarOption.minimum = 0;
            progressBarOption.maximum = 100;
            progressBarOption.progress = 50;
            progressBarOption.textVisible = true;
            progressBarOption.text = "50%";
//            progressBarOption.icon = systemIcon;
            QImage image(200, 30, QImage::Format_ARGB32);
            image.fill(Qt::transparent);
            QPainter imagePainter(&image);
            style.drawControl(QStyle::CE_ProgressBarLabel, &progressBarOption, &imagePainter, &widget);
        }


        // 测试 CE_ProgressBar
        {
            QStyleOptionProgressBar progressBarOption;
            progressBarOption.minimum = 0;
            progressBarOption.maximum = 100;
            progressBarOption.progress = 50;
            progressBarOption.textVisible = true;
            progressBarOption.text = "50%";
//            progressBarOption.icon = systemIcon;
            QImage image(200, 30, QImage::Format_ARGB32);
            image.fill(Qt::transparent);
            QPainter imagePainter(&image);
            style.drawControl(QStyle::CE_ProgressBar, &progressBarOption, &imagePainter, &widget);
        }


        // 测试 CE_HeaderSection
        {
            QStyleOptionHeader headerOption;
            headerOption.state = QStyle::State_Enabled;
            headerOption.text = "Header Section";
            headerOption.icon = systemIcon;
            QImage image(200, 30, QImage::Format_ARGB32);
            image.fill(Qt::transparent);
            QPainter imagePainter(&image);
            style.drawControl(QStyle::CE_HeaderSection, &headerOption, &imagePainter, &widget);
        }


        // 测试 CE_HeaderLabel
        {
            QStyleOptionHeader headerOption;
            headerOption.state = QStyle::State_Enabled;
            headerOption.text = "Header Label";
            headerOption.icon = systemIcon;
            QImage image(200, 30, QImage::Format_ARGB32);
            image.fill(Qt::transparent);
            QPainter imagePainter(&image);
            style.drawControl(QStyle::CE_HeaderLabel, &headerOption, &imagePainter, &widget);
        }


        // 测试 CE_HeaderEmptyArea
        {
            QStyleOptionHeader headerOption;
            headerOption.state = QStyle::State_Enabled;
            headerOption.text = "Header Empty Area";
            headerOption.icon = systemIcon;
            QImage image(200, 30, QImage::Format_ARGB32);
            image.fill(Qt::transparent);
            QPainter imagePainter(&image);
            style.drawControl(QStyle::CE_HeaderEmptyArea, &headerOption, &imagePainter, &widget);
        }


        // 测试 CE_Header
        {
            QStyleOptionHeader headerOption;
            headerOption.state = QStyle::State_Enabled;
            headerOption.text = "Header";
            headerOption.icon = systemIcon;
            QImage image(200, 30, QImage::Format_ARGB32);
            image.fill(Qt::transparent);
            QPainter imagePainter(&image);
            style.drawControl(QStyle::CE_Header, &headerOption, &imagePainter, &widget);
        }


        // 测试 CE_ItemViewItem
        {
            QStyleOptionViewItem itemOption;
            itemOption.text = "Item 1";
            itemOption.state = QStyle::State_Selected;
            itemOption.icon = systemIcon;
            QImage image(200, 30, QImage::Format_ARGB32);
            image.fill(Qt::transparent);
            QPainter imagePainter(&image);
            style.drawControl(QStyle::CE_ItemViewItem, &itemOption, &imagePainter, &widget);
        }


        // 测试 CE_ShapedFrame
        {
            QStyleOptionFrame frameOption;
            frameOption.frameShape = QFrame::Box;
            frameOption.state = QStyle::State_Raised;
//            frameOption.icon = systemIcon;
            QImage image(200, 200, QImage::Format_ARGB32);
            image.fill(Qt::transparent);
            QPainter imagePainter(&image);
            style.drawControl(QStyle::CE_ShapedFrame, &frameOption, &imagePainter, &widget);
        }


        // 测试 CE_ComboBox
        {
            QStyleOptionComboBox comboBoxOption;
            comboBoxOption.state = QStyle::State_Enabled;
            comboBoxOption.currentText = "Select Option";
//            comboBoxOption.icon = systemIcon;
            QImage image(200, 30, QImage::Format_ARGB32);
            image.fill(Qt::transparent);
            QPainter imagePainter(&image);
            style.drawControl(QStyle::CE_ComboBoxLabel, &comboBoxOption, &imagePainter, &widget);
        }


        // 测试 CE_MenuItem
        {
            QStyleOptionMenuItem menuItemOption;
            menuItemOption.state = QStyle::State_Enabled | QStyle::State_Selected;
            menuItemOption.text = "Menu Item";
            menuItemOption.icon = systemIcon;
            QImage image(200, 30, QImage::Format_ARGB32);
            image.fill(Qt::transparent);
            QPainter imagePainter(&image);

            widget.setProperty("setFrameradius", 2);
            widget.setProperty("setItemradius",  2);
            widget.setProperty("setMenuBackgroundBrush", QBrush(QColor(Qt::red)));
            widget.setProperty("setMenuBackgroundPen",   QPen(QColor(Qt::red)));
            widget.setProperty("setItemSelectBrush",     QBrush(QColor(Qt::red)));
            widget.setProperty("setMenuHoverPen",        QPen(QColor(Qt::red)));
            widget.setProperty("setItemFocusPen",        QPen(QColor(Qt::red)));

            style.drawControl(QStyle::CE_MenuItem, &menuItemOption, &imagePainter, &widget);
        }


        // 测试 CE_ToolButton
        {
            QStyleOptionToolButton toolButtonOption;
            toolButtonOption.state = QStyle::State_Enabled | QStyle::State_MouseOver;
            toolButtonOption.text = "Tool Button";
            toolButtonOption.icon = systemIcon;
            QImage image(100, 30, QImage::Format_ARGB32);
            image.fill(Qt::transparent);
            QPainter imagePainter(&image);

            widget.setProperty("setIconHighlight", true);
            widget.setProperty("setTextHighlight", true);
            widget.setProperty("setTextDefaultColor", QColor(Qt::red));
            widget.setProperty("setTextHoverColor",   QColor(Qt::red));
            widget.setProperty("setTextDisableColor", QColor(Qt::red));

            style.drawControl(QStyle::CE_ToolButtonLabel, &toolButtonOption, &imagePainter, &widget);
        }


        // 测试 CE_RadioButton
        {
            QStyleOptionButton radioButtonOption;
            radioButtonOption.state = QStyle::State_Enabled | QStyle::State_Selected;
            radioButtonOption.text = "Radio Button";
            radioButtonOption.icon = systemIcon;
            QImage image(150, 30, QImage::Format_ARGB32);
            image.fill(Qt::transparent);
            QPainter imagePainter(&image);
            style.drawControl(QStyle::CE_RadioButton, &radioButtonOption, &imagePainter, &widget);
        }


        // 测试布局方向
        {
            QStyleOptionButton buttonOption;
            buttonOption.state = QStyle::State_Enabled;
            buttonOption.text = "Test Button";
            buttonOption.icon = systemIcon;
            QImage leftToRightImage(200, 50, QImage::Format_ARGB32);
            QImage rightToLeftImage(200, 50, QImage::Format_ARGB32);
            leftToRightImage.fill(Qt::transparent);
            rightToLeftImage.fill(Qt::transparent);
            QPainter leftToRightPainter(&leftToRightImage);
            QPainter rightToLeftPainter(&rightToLeftImage);
            QGuiApplication::setLayoutDirection(Qt::LeftToRight);
            style.drawControl(QStyle::CE_PushButton, &buttonOption, &leftToRightPainter, &widget);
            QGuiApplication::setLayoutDirection(Qt::RightToLeft);
            style.drawControl(QStyle::CE_PushButton, &buttonOption, &rightToLeftPainter, &widget);
        }
    }
    void testSizeFromContents()
    {
        UKUIConfigStyle style("testSizeFromContentsStyle");

        // 测试 CT_MenuItem
        {
            QStyleOptionMenuItem menuItem;
            QWidget widget;
            QSize size(100, 20);
            style.sizeFromContents(UKUIConfigStyle::CT_MenuItem, &menuItem, size, &widget);
        }

        // 测试 CT_LineEdit
        {
            QStyleOptionFrame frameOption;
            QWidget widget;
            QSize size(100, 20);
            style.sizeFromContents(UKUIConfigStyle::CT_LineEdit, &frameOption, size, &widget);
        }

        // 测试 CT_TabBarTab
        {
            QStyleOptionTab tabOption;
            QWidget widget;
            QSize size(100, 20);
            style.sizeFromContents(UKUIConfigStyle::CT_TabBarTab, &tabOption, size, &widget);
        }

        // 测试 CT_RadioButton
        {
            QStyleOptionButton radioButtonOption;
            QWidget widget;
            QSize size(100, 20);
            style.sizeFromContents(UKUIConfigStyle::CT_RadioButton, &radioButtonOption, size, &widget);
        }

        // 测试 CT_CheckBox
        {
            QStyleOptionButton checkBoxOption;
            QWidget widget;
            QSize size(100, 20);
            style.sizeFromContents(UKUIConfigStyle::CT_CheckBox, &checkBoxOption, size, &widget);
        }

        // 测试 CT_ToolButton
        {
            QStyleOptionToolButton toolButtonOption;
            QWidget widget;
            QSize size(100, 20);
            style.sizeFromContents(UKUIConfigStyle::CT_ToolButton, &toolButtonOption, size, &widget);
        }

        // 测试 CT_PushButton
        {
            QStyleOptionButton pushButtonOption;
            QWidget widget;
            QSize size(100, 20);
            style.sizeFromContents(UKUIConfigStyle::CT_PushButton, &pushButtonOption, size, &widget);
        }

        // 测试 CT_ComboBox
        {
            QStyleOptionComboBox comboBoxOption;
            QWidget widget;
            QSize size(100, 20);
            style.sizeFromContents(UKUIConfigStyle::CT_ComboBox, &comboBoxOption, size, &widget);
        }

        // 测试 CT_SpinBox
        {
            QStyleOptionSpinBox spinBoxOption;
            QWidget widget;
            QSize size(100, 20);
            style.sizeFromContents(UKUIConfigStyle::CT_SpinBox, &spinBoxOption, size, &widget);
        }

        // 测试 CT_ProgressBar
        {
            QStyleOptionProgressBar progressBarOption;
            QWidget widget;
            QSize size(100, 20);
            style.sizeFromContents(UKUIConfigStyle::CT_ProgressBar, &progressBarOption, size, &widget);
        }

        // 测试 CT_Slider
        {
            QStyleOptionSlider sliderOption;
            QWidget widget;
            QSize size(100, 20);
            style.sizeFromContents(UKUIConfigStyle::CT_Slider, &sliderOption, size, &widget);
        }

        // 测试 CT_HeaderSection
        {
            QStyleOptionHeader headerOption;
            QWidget widget;
            QSize size(100, 20);
            style.sizeFromContents(UKUIConfigStyle::CT_HeaderSection, &headerOption, size, &widget);
        }

        // 测试 CT_ItemViewItem
        {
            QStyleOptionViewItem viewItemOption;
            QWidget widget;
            QSize size(100, 20);
            style.sizeFromContents(UKUIConfigStyle::CT_ItemViewItem, &viewItemOption, size, &widget);
        }
    }
    void testDrawComplexControl()
    {
        UKUIConfigStyle style("DrawComplexControlStyle");
        // 测试 CC_ScrollBar
        {
            QStyleOptionSlider sliderOption;
            sliderOption.orientation = Qt::Horizontal;
            sliderOption.state = QStyle::State_Enabled;
            QWidget widget;
            QImage image(200, 20, QImage::Format_ARGB32);
            image.fill(Qt::transparent);
            QPainter painter(&image);

            widget.setProperty("setRadius", 1);
            widget.setProperty("setGrooveDefaultBrush",     QBrush(QColor(Qt::red)));
            widget.setProperty("setGrooveInactiveBrush",     QBrush(QColor(Qt::red)));
            widget.setProperty("setSliderDefaultBrush",     QBrush(QColor(Qt::red)));
            widget.setProperty("setSliderHoverBrush",     QBrush(QColor(Qt::red)));
            widget.setProperty("setSliderClickBrush",     QBrush(QColor(Qt::red)));
            widget.setProperty("setSliderDisableBrush",     QBrush(QColor(Qt::red)));

            style.drawComplexControl(QStyle::CC_ScrollBar, &sliderOption, &painter, &widget);
            // 可添加更具体的断言，例如检查绘制的颜色、矩形位置和大小等
        }

        // 测试 CC_Slider
        {
            QStyleOptionSlider sliderOption;
            sliderOption.orientation = Qt::Horizontal;
            sliderOption.state = QStyle::State_Enabled;
            QWidget widget;
            QImage image(200, 20, QImage::Format_ARGB32);
            image.fill(Qt::transparent);
            QPainter painter(&image);

            widget.setProperty("setRadius",                    1);
            widget.setProperty("setGrooveRadius",              QBrush(QColor(Qt::red)));
            widget.setProperty("setHandleDefaultBrush",        QBrush(QColor(Qt::red)));
            widget.setProperty("setHandleHoverBrush",          QBrush(QColor(Qt::red)));
            widget.setProperty("setHandleClickBrush",          QBrush(QColor(Qt::red)));
            widget.setProperty("setHandleDisableBrush",        QBrush(QColor(Qt::red)));
            widget.setProperty("setGrooveValueDefaultBrush",   QBrush(QColor(Qt::red)));
            widget.setProperty("setGrooveValueHoverBrush",     QBrush(QColor(Qt::red)));
            widget.setProperty("setGrooveValueDisableBrush",   QBrush(QColor(Qt::red)));
            widget.setProperty("setGrooveUnvalueDefaultBrush", QBrush(QColor(Qt::red)));
            widget.setProperty("setGrooveUnvalueHoverBrush",   QBrush(QColor(Qt::red)));
            widget.setProperty("setGrooveUnvalueDisableBrush", QBrush(QColor(Qt::red)));
            widget.setProperty("setHandleDefaultPen",          QPen(QColor(Qt::red)));
            widget.setProperty("setHandleHoverPen",            QPen(QColor(Qt::red)));
            widget.setProperty("setHandleClickPen",            QPen(QColor(Qt::red)));
            widget.setProperty("setHandleDisablePen",          QPen(QColor(Qt::red)));
            widget.setProperty("setSliderGroovePen",           QPen(QColor(Qt::red)));
            widget.setProperty("setFocusPen",                  QPen(QColor(Qt::red)));

            style.drawComplexControl(QStyle::CC_Slider, &sliderOption, &painter, &widget);
            // 可添加更具体的断言，例如检查绘制的颜色、矩形位置和大小等
        }

        // 测试 CC_ComboBox
        {
            QStyleOptionComboBox comboBoxOption;
            comboBoxOption.state = QStyle::State_Enabled;
            QWidget widget;
            QImage image(200, 30, QImage::Format_ARGB32);
            image.fill(Qt::transparent);
            QPainter painter(&image);

            widget.setProperty("setRadius", 1);
            widget.setProperty("setDefaultBrush",   QBrush(QColor(Qt::red)));
            widget.setProperty("setOnBrush",        QBrush(QColor(Qt::red)));
            widget.setProperty("setHoverBrush",     QBrush(QColor(Qt::red)));
            widget.setProperty("setDisableBrush",   QBrush(QColor(Qt::red)));
            widget.setProperty("setEditBrush",      QBrush(QColor(Qt::red)));
            widget.setProperty("setDefaultPen",     QPen(QColor(Qt::red)));
            widget.setProperty("setHoverPen",       QPen(QColor(Qt::red)));
            widget.setProperty("setDisablePen",     QPen(QColor(Qt::red)));
            widget.setProperty("setOnPen",          QPen(QColor(Qt::red)));
            widget.setProperty("setEditPen",        QPen(QColor(Qt::red)));
            widget.setProperty("setFocusPen",       QPen(QColor(Qt::red)));

            style.drawComplexControl(QStyle::CC_ComboBox, &comboBoxOption, &painter, &widget);
            // 可添加更具体的断言，例如检查绘制的颜色、矩形位置和大小等
        }

        // 测试 CC_SpinBox
        {
            QStyleOptionSpinBox spinBoxOption;
            spinBoxOption.state = QStyle::State_Enabled;
            QWidget widget;
            QImage image(200, 30, QImage::Format_ARGB32);
            image.fill(Qt::transparent);
            QPainter painter(&image);

            widget.setProperty("setRadius", 1);
            widget.setProperty("setDefaultBrush",        QBrush(QColor(Qt::red)));
            widget.setProperty("setFocusBrush",          QBrush(QColor(Qt::red)));
            widget.setProperty("setHoverBrush",          QBrush(QColor(Qt::red)));
            widget.setProperty("setDisableBrush",        QBrush(QColor(Qt::red)));
            widget.setProperty("setDefaultPen",          QPen(QColor(Qt::red)));
            widget.setProperty("setHoverPen",            QPen(QColor(Qt::red)));
            widget.setProperty("setDisablePen",          QPen(QColor(Qt::red)));
            widget.setProperty("setFocusPen",            QPen(QColor(Qt::red)));
            widget.setProperty("setUpDefaultBrush",      QBrush(QColor(Qt::red)));
            widget.setProperty("setUpFocusHoverBrush",   QBrush(QColor(Qt::red)));
            widget.setProperty("setUpClickBrush",        QBrush(QColor(Qt::red)));
            widget.setProperty("setUpHoverBrush",        QBrush(QColor(Qt::red)));
            widget.setProperty("setDownDefaultBrush",    QBrush(QColor(Qt::red)));
            widget.setProperty("setDownHoverBrush",      QBrush(QColor(Qt::red)));
            widget.setProperty("setDownFocusHoverBrush", QBrush(QColor(Qt::red)));
            widget.setProperty("setDownClickBrush",      QBrush(QColor(Qt::red)));
            widget.setProperty("setUpDefaultPen",        QPen(QColor(Qt::red)));
            widget.setProperty("setUpHoverPen",          QPen(QColor(Qt::red)));
            widget.setProperty("setUpFocusHoverPen",     QPen(QColor(Qt::red)));
            widget.setProperty("setUpClickPen",          QPen(QColor(Qt::red)));
            widget.setProperty("setUpDisablePen",        QPen(QColor(Qt::red)));
            widget.setProperty("setDownDefaultPen",      QPen(QColor(Qt::red)));
            widget.setProperty("setDownHoverPen",        QPen(QColor(Qt::red)));
            widget.setProperty("setDownFocusHoverPen",   QPen(QColor(Qt::red)));
            widget.setProperty("setDownClickPen",        QPen(QColor(Qt::red)));
            widget.setProperty("setDownDisablePen",      QPen(QColor(Qt::red)));

            style.drawComplexControl(QStyle::CC_SpinBox, &spinBoxOption, &painter, &widget);
            // 可添加更具体的断言，例如检查绘制的颜色、矩形位置和大小等
        }

        // 测试 CC_Dial
        {
            QStyleOptionSlider dialOption;
            dialOption.orientation = Qt::Horizontal;
            dialOption.state = QStyle::State_Enabled;
            QWidget widget;
            QImage image(200, 200, QImage::Format_ARGB32);
            image.fill(Qt::transparent);
            QPainter painter(&image);
            style.drawComplexControl(QStyle::CC_Dial, &dialOption, &painter, &widget);
            // 可添加更具体的断言，例如检查绘制的颜色、矩形位置和大小等
        }

        // 测试 CC_ToolButton
        {
            QStyleOptionToolButton toolButtonOption;
            toolButtonOption.state = QStyle::State_Enabled;
            QWidget widget;
            QImage image(100, 30, QImage::Format_ARGB32);
            image.fill(Qt::transparent);
            QPainter painter(&image);
            style.drawComplexControl(QStyle::CC_ToolButton, &toolButtonOption, &painter, &widget);
            // 可添加更具体的断言，例如检查绘制的颜色、矩形位置和大小等
        }

        // 测试 CC_GroupBox
        {
            QStyleOptionGroupBox groupBoxOption;
            groupBoxOption.state = QStyle::State_Enabled;
            groupBoxOption.text = "Group Box";
            QWidget widget;
            QImage image(200, 200, QImage::Format_ARGB32);
            image.fill(Qt::transparent);
            QPainter painter(&image);
            style.drawComplexControl(QStyle::CC_GroupBox, &groupBoxOption, &painter, &widget);
            // 可添加更具体的断言，例如检查绘制的颜色、矩形位置和大小等
        }
    }
    void testSubElementRect()
    {
        UKUIConfigStyle style("SubElementRectstyle");
        QWidget widget;

        // 测试 SE_TabBarScrollLeftButton
        {
            QStyleOptionTab tabOption;
            tabOption.direction = Qt::LeftToRight;
            tabOption.rect = QRect(0, 0, 100, 30);
            QRect result = style.subElementRect(UKUIConfigStyle::SE_TabBarScrollLeftButton, &tabOption, &widget);
            // 这里可以输出结果，以便手动检查
            qDebug() << "SE_TabBarScrollLeftButton result: " << result;
        }

        // 测试 SE_TabBarScrollRightButton
        {
            QStyleOptionTab tabOption;
            tabOption.direction = Qt::LeftToRight;
            tabOption.rect = QRect(0, 0, 100, 30);
            QRect result = style.subElementRect(UKUIConfigStyle::SE_TabBarScrollRightButton, &tabOption, &widget);
            // 这里可以输出结果，以便手动检查
            qDebug() << "SE_TabBarScrollRightButton result: " << result;
        }

        // 测试 SE_TabBarTabLeftButton
        {
            QStyleOptionTab tabOption;
            tabOption.direction = Qt::LeftToRight;
            tabOption.rect = QRect(0, 0, 100, 30);
            tabOption.shape = QTabBar::RoundedNorth;
            tabOption.leftButtonSize = QSize(10, 10);
            QRect result = style.subElementRect(UKUIConfigStyle::SE_TabBarTabLeftButton, &tabOption, &widget);
            // 这里可以输出结果，以便手动检查
            qDebug() << "SE_TabBarTabLeftButton result: " << result;
        }

        // 测试 SE_TabBarTabRightButton
        {
            QStyleOptionTab tabOption;
            tabOption.direction = Qt::LeftToRight;
            tabOption.rect = QRect(0, 0, 100, 30);
            tabOption.shape = QTabBar::RoundedNorth;
            tabOption.rightButtonSize = QSize(10, 10);
            QRect result = style.subElementRect(UKUIConfigStyle::SE_TabBarTabRightButton, &tabOption, &widget);
            // 这里可以输出结果，以便手动检查
            qDebug() << "SE_TabBarTabRightButton result: " << result;
        }

        // 测试 SE_TabBarTabText
        {
            QStyleOptionTab tabOption;
            tabOption.direction = Qt::LeftToRight;
            tabOption.rect = QRect(0, 0, 100, 30);
            QRect result = style.subElementRect(UKUIConfigStyle::SE_TabBarTabText, &tabOption, &widget);
            // 这里可以输出结果，以便手动检查
            qDebug() << "SE_TabBarTabText result: " << result;
        }

        // 测试 SE_TabWidgetTabPane
        {
            QStyleOptionTabWidgetFrame tabWidgetFrameOption;
            tabWidgetFrameOption.direction = Qt::LeftToRight;
            tabWidgetFrameOption.rect = QRect(0, 0, 100, 100);
            tabWidgetFrameOption.tabBarSize = QSize(80, 30);
            tabWidgetFrameOption.lineWidth = 2;
            QRect result = style.subElementRect(UKUIConfigStyle::SE_TabWidgetTabPane, &tabWidgetFrameOption, &widget);
            // 这里可以输出结果，以便手动检查
            qDebug() << "SE_TabWidgetTabPane result: " << result;
        }

        // 测试 SE_TabWidgetTabContents
        {
            QStyleOptionTabWidgetFrame tabWidgetFrameOption;
            tabWidgetFrameOption.direction = Qt::LeftToRight;
            tabWidgetFrameOption.rect = QRect(0, 0, 100, 100);
            QRect result = style.subElementRect(UKUIConfigStyle::SE_TabWidgetTabContents, &tabWidgetFrameOption, &widget);
            // 这里可以输出结果，以便手动检查
            qDebug() << "SE_TabWidgetTabContents result: " << result;
        }

        // 测试 SE_TabWidgetTabBar
        {
            QStyleOptionTabWidgetFrame tabWidgetFrameFrameOption;
            tabWidgetFrameFrameOption.direction = Qt::LeftToRight;
            tabWidgetFrameFrameOption.rect = QRect(0, 0, 100, 100);
            tabWidgetFrameFrameOption.tabBarSize = QSize(80, 30);
            tabWidgetFrameFrameOption.shape = QTabBar::RoundedNorth;
            tabWidgetFrameFrameOption.leftCornerWidgetSize = QSize(10, 10);
            tabWidgetFrameFrameOption.rightCornerWidgetSize = QSize(10, 10);
            QRect result = style.subElementRect(UKUIConfigStyle::SE_TabWidgetTabBar, &tabWidgetFrameFrameOption, &widget);
            // 这里可以输出结果，以便手动检查
            qDebug() << "SE_TabWidgetTabBar result: " << result;
        }

        // 测试 SE_TabWidgetLeftCorner
        {
            QStyleOptionTabWidgetFrame tabWidgetFrameOption;
            tabWidgetFrameOption.direction = Qt::LeftToRight;
            tabWidgetFrameOption.rect = QRect(0, 0, 100, 100);
            tabWidgetFrameOption.shape = QTabBar::RoundedNorth;
            tabWidgetFrameOption.leftCornerWidgetSize = QSize(10, 10);
            QRect result = style.subElementRect(UKUIConfigStyle::SE_TabWidgetLeftCorner, &tabWidgetFrameOption, &widget);
            // 这里可以输出结果，以便手动检查
            qDebug() << "SE_TabWidgetLeftCorner result: " << result;
        }

        // 测试 SE_TabWidgetRightCorner
        {
            QStyleOptionTabWidgetFrame tabWidgetFrameOption;
            tabWidgetFrameOption.direction = Qt::LeftToRight;
            tabWidgetFrameOption.rect = QRect(0, 0, 100, 100);
            tabWidgetFrameOption.shape = QTabBar::RoundedNorth;
            tabWidgetFrameOption.rightCornerWidgetSize = QSize(10, 10);
            QRect result = style.subElementRect(UKUIConfigStyle::SE_TabWidgetRightCorner, &tabWidgetFrameOption, &widget);
            // 这里可以输出结果，以便手动检查
            qDebug() << "SE_TabWidgetRightCorner result: " << result;
        }

        // 测试 SE_RadioButtonIndicator
        {
            QStyleOptionButton buttonOption;
            buttonOption.direction = Qt::LeftToRight;
            buttonOption.rect = QRect(0, 0, 50, 30);
            QRect result = style.subElementRect(UKUIConfigStyle::SE_RadioButtonIndicator, &buttonOption, &widget);
            // 这里可以输出结果，以便手动检查
            qDebug() << "SE_RadioButtonIndicator result: " << result;
        }

        // 测试 SE_RadioButtonContents
        {
            QStyleOptionButton buttonOption;
            buttonOption.direction = Qt::LeftToRight;
            buttonOption.rect = QRect(0, 0, 50, 30);
            QRect result = style.subElementRect(UKUIConfigStyle::SE_RadioButtonContents, &buttonOption, &widget);
            // 这里可以输出结果，以便手动检查
            qDebug() << "SE_RadioButtonContents result: " << result;
        }

        // 测试 SE_CheckBoxIndicator
        {
            QStyleOptionButton buttonOption;
            buttonOption.direction = Qt::LeftToRight;
            buttonOption.rect = QRect(0, 0, 50, 30);
            QRect result = style.subElementRect(UKUIConfigStyle::SE_CheckBoxIndicator, &buttonOption, &widget);
            // 这里可以输出结果，以便手动检查
            qDebug() << "SE_CheckBoxIndicator result: " << result;
        }

        // 测试 SE_CheckBoxContents
        {
            QStyleOptionButton buttonOption;
            buttonOption.direction = Qt::LeftToRight;
            buttonOption.rect = QRect(0, 0, 50, 30);
            QRect result = style.subElementRect(UKUIConfigStyle::SE_CheckBoxContents, &buttonOption, &widget);
            // 这里可以输出结果，以便手动检查
            qDebug() << "SE_CheckBoxContents result: " << result;
        }

        // 测试 SE_PushButtonContents
        {
            QStyleOptionButton buttonOption;
            buttonOption.direction = Qt::LeftToRight;
            buttonOption.rect = QRect(0, 0, 50, 30);
            QRect result = style.subElementRect(UKUIConfigStyle::SE_PushButtonContents, &buttonOption, &widget);
            // 这里可以输出结果，以便手动检查
            qDebug() << "SE_PushButtonContents result: " << result;
        }

        // 测试 SE_LineEditContents
        {
            QStyleOptionFrame frameOption;
            frameOption.direction = Qt::LeftToRight;
            frameOption.rect = QRect(0, 0, 100, 30);
            QRect result = style.subElementRect(UKUIConfigStyle::SE_LineEditContents, &frameOption, &widget);
            // 这里可以输出结果，以便手动检查
            qDebug() << "SE_LineEditContents result: " << result;
        }

        // 测试 SE_ProgressBarGroove
        {
            QStyleOptionProgressBar progressBarOption;
            progressBarOption.direction = Qt::LeftToRight;
            progressBarOption.rect = QRect(0, 0, 100, 30);
            QRect result = style.subElementRect(UKUIConfigStyle::SE_ProgressBarGroove, &progressBarOption, &widget);
            // 这里可以输出结果，以便手动检查
            qDebug() << "SE_ProgressBarGroove result: " << result;
        }

        // 测试 SE_ProgressBarLabel
        {
            QStyleOptionProgressBar progressBarOption;
            progressBarOption.direction = Qt::LeftToRight;
            progressBarOption.rect = QRect(0, 0, 100, 30);
            QRect result = style.subElementRect(UKUIConfigStyle::SE_ProgressBarLabel, &progressBarOption, &widget);
            // 这里可以输出结果，以便手动检查
            qDebug() << "SE_ProgressBarLabel result: " << result;
        }

        // 测试 SE_ProgressBarContents
        {
            QStyleOptionProgressBar progressBarOption;
            progressBarOption.direction = Qt::LeftToRight;
            progressBarOption.rect = QRect(0, 0, 100, 30);
            QRect result = style.subElementRect(UKUIConfigStyle::SE_ProgressBarContents, &progressBarOption, &widget);
            // 这里可以输出结果，以便手动检查
            qDebug() << "SE_ProgressBarContents result: " << result;
        }

        // 测试 SE_HeaderLabel
        {
            QStyleOptionHeader headerOption;
            headerOption.direction = Qt::LeftToRight;
            headerOption.rect = QRect(0, 0, 100, 30);
            QRect result = style.subElementRect(UKUIConfigStyle::SE_HeaderLabel, &headerOption, &widget);
            // 这里可以输出结果，以便手动检查
            qDebug() << "SE_HeaderLabel result: " << result;
        }

        // 测试 SE_HeaderArrow
        {
            QStyleOptionHeader headerOption;
            headerOption.direction = Qt::LeftToRight;
            headerOption.rect = QRect(0, 0, 100, 30);
            QRect result = style.subElementRect(UKUIConfigStyle::SE_HeaderArrow, &headerOption, &widget);
            // 这里可以输出结果，以便手动检查
            qDebug() << "SE_HeaderArrow result: " << result;
        }

        // 测试 SE_ItemViewItemCheckIndicator
        {
            QStyleOptionViewItem viewItemOption;
            viewItemOption.direction = Qt::LeftToRight;
            viewItemOption.rect = QRect(0, 0, 100, 30);
            QRect result = style.subElementRect(UKUIConfigStyle::SE_ItemViewItemCheckIndicator, &viewItemOption, &widget);
            // 这里可以输出结果，以便手动检查
            qDebug() << "SE_ItemViewItemCheckIndicator result: " << result;
        }

        // 测试 SE_ItemViewItemDecoration
        {
            QStyleOptionViewItem viewItemOption;
            viewItemOption.direction = Qt::LeftToRight;
            viewItemOption.rect = QRect(0, 0, 100, 30);
            QRect result = style.subElementRect(UKUIConfigStyle::SE_ItemViewItemDecoration, &viewItemOption, &widget);
            // 这里可以输出结果，以便手动检查
            qDebug() << "SE_ItemViewItemDecoration result: " << result;
        }

        // 测试 SE_ItemViewItemText
        {
            QStyleOptionViewItem viewItemOption;
            viewItemOption.direction = Qt::LeftToRight;
            viewItemOption.rect = QRect(0, 0, 100, 30);
            QRect result = style.subElementRect(UKUIConfigStyle::SE_ItemViewItemText, &viewItemOption, &widget);
            // 这里可以输出结果，以便手动检查
            qDebug() << "SE_ItemViewItemText result: " << result;
        }

        // 测试 SE_ItemViewItemFocusRect
        {
            QStyleOptionViewItem viewItemOption;
            viewItemOption.direction = Qt::LeftToRight;
            viewItemOption.rect = QRect(0, 0, 100, 30);
            QRect result = style.subElementRect(UKUIConfigStyle::SE_ItemViewItemFocusRect, &viewItemOption, &widget);
            // 这里可以输出结果，以便手动检查
            qDebug() << "SE_ItemViewItemFocusRect result: " << result;
        }

        // 测试 SE_TreeViewDisclosureItem
        {
            QStyleOptionViewItem viewItemOption;
            viewItemOption.direction = Qt::LeftToRight;
            viewItemOption.rect = QRect(0, 0, 100, 30);
            QRect result = style.subElementRect(UKUIConfigStyle::SE_TreeViewDisclosureItem, &viewItemOption, &widget);
            // 这里可以输出结果，以便手动检查
            qDebug() << "SE_TreeViewDisclosureItem result: " << result;
        }
    }
    void testDrawPrimitive()
    {
        UKUIConfigStyle style("DrawPrimitiveStyle");
        QWidget widget;
        QPainter painter;

        // 测试 PE_PanelMenu
        {
            QStyleOption option;
            option.rect = QRect(0, 0, 100, 100);
            option.state = QStyle::State_None;
            option.palette = widget.palette();
            option.direction = Qt::LeftToRight;
            widget.setProperty("setFrameradius", 1);
            widget.setProperty("setItemradius",  1);
            widget.setProperty("setMenuBackgroundBrush", QBrush(QColor(Qt::red)));
            widget.setProperty("setMenuBackgroundPen",   QPen(QColor(Qt::red)));
            widget.setProperty("setItemSelectBrush",     QBrush(QColor(Qt::red)));
            widget.setProperty("setMenuHoverPen",        QPen(QColor(Qt::red)));
            widget.setProperty("setItemFocusPen",        QPen(QColor(Qt::red)));

            style.drawPrimitive(QStyle::PE_PanelMenu, &option, &painter, &widget);
            // 可以添加检查绘制结果的逻辑，例如使用 QImage 捕获绘制结果，检查颜色、形状等
        }

        // 测试 PE_FrameMenu
        {
            QStyleOption option;
            option.rect = QRect(0, 0, 100, 100);
            option.state = QStyle::State_None;
            option.palette = widget.palette();
            option.direction = Qt::LeftToRight;
            style.drawPrimitive(QStyle::PE_FrameMenu, &option, &painter, &widget);
            // 可以添加检查绘制结果的逻辑，例如使用 QImage 捕获绘制结果，检查颜色、形状等
        }

        // 测试 PE_FrameFocusRect
        {
            QStyleOption option;
            option.rect = QRect(0, 0, 100, 100);
            option.state = QStyle::State_None;
            option.palette = widget.palette();
            option.direction = Qt::LeftToRight;

            widget.setProperty("setRadius", 1);
            widget.setProperty("setDefaultBrush",       QBrush(QColor(Qt::red)));
            widget.setProperty("setHoverBrush",         QBrush(QColor(Qt::red)));
            widget.setProperty("setDisableBrush",       QBrush(QColor(Qt::red)));
            widget.setProperty("setSelectBrush",        QBrush(QColor(Qt::red)));
            widget.setProperty("setBranchDefaultBrush", QBrush(QColor(Qt::red)));
            widget.setProperty("setBranchHoverBrush",   QBrush(QColor(Qt::red)));
            widget.setProperty("setBranchSelectBrush",  QBrush(QColor(Qt::red)));
            widget.setProperty("setBranchDisableBrush", QBrush(QColor(Qt::red)));
            widget.setProperty("setTextHoverPen",       QPen(QColor(Qt::red)));
            widget.setProperty("setTextSelectPen",      QPen(QColor(Qt::red)));
            widget.setProperty("setTextDisablePen",     QPen(QColor(Qt::red)));
            widget.setProperty("setHoverPen",           QPen(QColor(Qt::red)));
            widget.setProperty("setSelectPen",          QPen(QColor(Qt::red)));
            widget.setProperty("setFocusPen",           QPen(QColor(Qt::red)));

            style.drawPrimitive(QStyle::PE_FrameFocusRect, &option, &painter, &widget);
            // 可以添加检查绘制结果的逻辑，例如使用 QImage 捕获绘制结果，检查颜色、形状等
        }

        // 测试 PE_Frame
        {
            QStyleOption option;
            option.rect = QRect(0, 0, 100, 100);
            option.state = QStyle::State_None;
            option.palette = widget.palette();
            option.direction = Qt::LeftToRight;
            style.drawPrimitive(QStyle::PE_Frame, &option, &painter, &widget);
            // 可以添加检查绘制结果的逻辑，例如使用 QImage 捕获绘制结果，检查颜色、形状等
        }

        // 测试 PE_PanelButtonCommand
        {
            QStyleOptionButton buttonOption;
            buttonOption.rect = QRect(0, 0, 100, 100);
            buttonOption.state = QStyle::State_None;
            buttonOption.palette = widget.palette();
            buttonOption.direction = Qt::LeftToRight;
            style.drawPrimitive(QStyle::PE_PanelButtonCommand, &buttonOption, &painter, &widget);
            // 可以添加检查绘制结果的逻辑，例如使用 QImage 捕获绘制结果，检查颜色、形状等
        }

        // 测试 PE_PanelTipLabel
        {
            QStyleOption option;
            option.rect = QRect(0, 0, 100, 100);
            option.state = QStyle::State_None;
            option.palette = widget.palette();
            option.direction = Qt::LeftToRight;
            widget.setProperty("setRadius", 1);
            widget.setProperty("setBackgroundBrush",     QBrush(QColor(Qt::red)));
            widget.setProperty("setBackgroundPen",     QPen(QColor(Qt::red)));
            style.drawPrimitive(QStyle::PE_PanelTipLabel, &option, &painter, &widget);
            // 可以添加检查绘制结果的逻辑，例如使用 QImage 捕获绘制结果，检查颜色、形状等
        }

        // 测试 PE_FrameStatusBar
        {
            QStyleOption option;
            option.rect = QRect(0, 0, 100, 100);
            option.state = QStyle::State_None;
            option.palette = widget.palette();
            option.direction = Qt::LeftToRight;
            style.drawPrimitive(QStyle::PE_FrameStatusBar, &option, &painter, &widget);
            // 可以添加检查绘制结果的逻辑，例如使用 QImage 捕获绘制结果，检查颜色、形状等
        }

        // 测试 PE_IndicatorButtonDropDown
        {
            QStyleOption option;
            option.rect = QRect(0, 0, 100, 100);
            option.state = QStyle::State_None;
            option.palette = widget.palette();
            option.direction = Qt::LeftToRight;
            style.drawPrimitive(QStyle::PE_IndicatorButtonDropDown, &option, &painter, &widget);
            // 可以添加检查绘制结果的逻辑，例如使用 QImage 捕获绘制结果，检查颜色、形状等
        }

        // 测试 PE_PanelButtonTool
        {
            QStyleOptionButton buttonOption;
            buttonOption.rect = QRect(0, 0, 100, 100);
            buttonOption.state = QStyle::State_None;
            buttonOption.palette = widget.palette();
            buttonOption.direction = Qt::LeftToRight;
            widget.setProperty("setRadius", 1);
            widget.setProperty("setDefaultBrush",      QBrush(QColor(Qt::red)));
            widget.setProperty("setClickBrush",        QBrush(QColor(Qt::red)));
            widget.setProperty("setHoverBrush",        QBrush(QColor(Qt::red)));
            widget.setProperty("setDisableBrush",      QBrush(QColor(Qt::red)));
            widget.setProperty("setCheckBrush",        QBrush(QColor(Qt::red)));
            widget.setProperty("setCheckHoverBrush",   QBrush(QColor(Qt::red)));
            widget.setProperty("setCheckClickBrush",   QBrush(QColor(Qt::red)));
            widget.setProperty("setCheckDisableBrush", QBrush(QColor(Qt::red)));
            widget.setProperty("setDefaultPen",        QPen(QColor(Qt::red)));
            widget.setProperty("setClickPen",          QPen(QColor(Qt::red)));
            widget.setProperty("setHoverPen",          QPen(QColor(Qt::red)));
            widget.setProperty("setDisablePen",        QPen(QColor(Qt::red)));
            widget.setProperty("setCheckPen",          QPen(QColor(Qt::red)));
            widget.setProperty("setCheckHoverPen",     QPen(QColor(Qt::red)));
            widget.setProperty("setCheckClickPen",     QPen(QColor(Qt::red)));
            widget.setProperty("setCheckDisablePen",   QPen(QColor(Qt::red)));
            widget.setProperty("setFocusPen",          QPen(QColor(Qt::red)));
            style.drawPrimitive(QStyle::PE_PanelButtonTool, &buttonOption, &painter, &widget);

            // 可以添加检查绘制结果的逻辑，例如使用 QImage 捕获绘制结果，检查颜色、形状等
        }

        // 测试 PE_IndicatorTabClose
        {
            QStyleOption option;
            option.rect = QRect(0, 0, 100, 100);
            option.state = QStyle::State_None;
            option.palette = widget.palette();
            option.direction = Qt::LeftToRight;
            style.drawPrimitive(QStyle::PE_IndicatorTabClose, &option, &painter, &widget);
            // 可以添加检查绘制结果的逻辑，例如使用 QImage 捕获绘制结果，检查颜色、形状等
        }

        // 测试 PE_FrameTabBarBase
        {
            QStyleOptionTabBarBase tabBarBaseOption;
            tabBarBaseOption.tabBarRect = QRect(0, 0, 100, 100);
            tabBarBaseOption.state = QStyle::State_None;
            tabBarBaseOption.palette = widget.palette();
            tabBarBaseOption.direction = Qt::LeftToRight;
            style.drawPrimitive(QStyle::PE_FrameTabBarBase, &tabBarBaseOption, &painter, &widget);
            // 可以添加检查绘制结果的逻辑，例如使用 QImage 捕获绘制结果，检查颜色、形状等
        }

        // 测试 PE_FrameTabWidget
        {
            QStyleOptionTabWidgetFrame tabWidgetFrameOption;
            tabWidgetFrameOption.rect = QRect(0, 0, 100, 100);
            tabWidgetFrameOption.state = QStyle::State_None;
            tabWidgetFrameOption.palette = widget.palette();
            tabWidgetFrameOption.direction = Qt::LeftToRight;
            widget.setProperty("setRadius", 1);
            widget.setProperty("setWidgetBackgroundBrush", QBrush(QColor(Qt::red)));
            widget.setProperty("setTabBarBackgroundBrush", QBrush(QColor(Qt::red)));
            widget.setProperty("setTabBarDefaultBrush",    QBrush(QColor(Qt::red)));
            widget.setProperty("setTabBarHoverBrush",      QBrush(QColor(Qt::red)));
            widget.setProperty("setTabBarClickBrush",      QBrush(QColor(Qt::red)));
            widget.setProperty("setTabBarSelectBrush",     QBrush(QColor(Qt::red)));
            widget.setProperty("setTabBarDefaultPen",      QPen(QColor(Qt::red)));
            widget.setProperty("setTabBarFocusPen",        QPen(QColor(Qt::red)));
            widget.setProperty("setTabBarClickPen",        QPen(QColor(Qt::red)));
            widget.setProperty("setTabBarHoverPen",        QPen(QColor(Qt::red)));
            style.drawPrimitive(QStyle::PE_FrameTabWidget, &tabWidgetFrameOption, &painter, &widget);

            // 可以添加检查绘制结果的逻辑，例如使用 QImage 捕获绘制结果，检查颜色、形状等
        }

        // 测试 PE_FrameGroupBox
        {
            QStyleOption option;
            option.rect = QRect(0, 0, 100, 100);
            option.state = QStyle::State_None;
            option.palette = widget.palette();
            option.direction = Qt::LeftToRight;
            style.drawPrimitive(QStyle::PE_FrameGroupBox, &option, &painter, &widget);
            // 可以添加检查绘制结果的逻辑，例如使用 QImage 捕获绘制结果，检查颜色、形状等
        }

        // 测试 PE_PanelLineEdit
        {
            QStyleOptionFrame frameOption;
            frameOption.rect = QRect(0, 0, 100, 100);
            frameOption.state = QStyle::State_None;
            frameOption.palette = widget.palette();
            frameOption.direction = Qt::LeftToRight;
            widget.setProperty("setRadius", 1);
            widget.setProperty("setDefaultBrush",      QBrush(QColor(Qt::red)));
            widget.setProperty("setFocusBrush",        QBrush(QColor(Qt::red)));
            widget.setProperty("setHoverBrush",        QBrush(QColor(Qt::red)));
            widget.setProperty("setDisableBrush",      QBrush(QColor(Qt::red)));
            widget.setProperty("setDefaultPen",        QPen(QColor(Qt::red)));
            widget.setProperty("setHoverPen",          QPen(QColor(Qt::red)));
            widget.setProperty("setDisablePen",        QPen(QColor(Qt::red)));
            widget.setProperty("setFocusPen",          QPen(QColor(Qt::red)));
            style.drawPrimitive(QStyle::PE_PanelLineEdit, &frameOption, &painter, &widget);

            // 可以添加检查绘制结果的逻辑，例如使用 QImage 捕获绘制结果，检查颜色、形状等
        }

        // 测试 PE_IndicatorArrowUp
        {
            QStyleOption option;
            option.rect = QRect(0, 0, 100, 100);
            option.state = QStyle::State_None;
            option.palette = widget.palette();
            option.direction = Qt::LeftToRight;
            style.drawPrimitive(QStyle::PE_IndicatorArrowUp, &option, &painter, &widget);
            // 可以添加检查绘制结果的逻辑，例如使用 QImage 捕获绘制结果，检查颜色、形状等
        }

        // 测试 PE_IndicatorArrowDown
        {
            QStyleOption option;
            option.rect = QRect(0, 0, 100, 100);
            option.state = QStyle::State_None;
            option.palette = widget.palette();
            option.direction = Qt::LeftToRight;
            style.drawPrimitive(QStyle::PE_IndicatorArrowDown, &option, &painter, &widget);
            // 可以添加检查绘制结果的逻辑，例如使用 QImage 捕获绘制结果，检查颜色、形状等
        }

        // 测试 PE_IndicatorArrowRight
        {
            QStyleOption option;
            option.rect = QRect(0, 0, 100, 100);
            option.state = QStyle::State_None;
            option.palette = widget.palette();
            option.direction = Qt::LeftToRight;
            style.drawPrimitive(QStyle::PE_IndicatorArrowRight, &option, &painter, &widget);
            // 可以添加检查绘制结果的逻辑，例如使用 QImage 捕获绘制结果，检查颜色、形状等
        }

        // 测试 PE_IndicatorArrowLeft
        {
            QStyleOption option;
            option.rect = QRect(0, 0, 100, 100);
            option.state = QStyle::State_None;
            option.palette = widget.palette();
            option.direction = Qt::LeftToRight;
            style.drawPrimitive(QStyle::PE_IndicatorArrowLeft, &option, &painter, &widget);
            // 可以添加检查绘制结果的逻辑，例如使用 QImage 捕获绘制结果，检查颜色、形状等
        }

        // 测试 PE_IndicatorRadioButton
        {
            QStyleOptionButton radioButtonOption;
            radioButtonOption.rect = QRect(0, 0, 100, 100);
            radioButtonOption.state = QStyle::State_None;
            radioButtonOption.palette = widget.palette();
            radioButtonOption.direction = Qt::LeftToRight;
            widget.setProperty("setRadius", 1);
            widget.setProperty("setDefaultBrush",           QBrush(QColor(Qt::red)));
            widget.setProperty("setHoverBrush",             QBrush(QColor(Qt::red)));
            widget.setProperty("setClickBrush",             QBrush(QColor(Qt::red)));
            widget.setProperty("setDisableBrush",           QBrush(QColor(Qt::red)));
            widget.setProperty("setOnDefaultBrush",         QBrush(QColor(Qt::red)));
            widget.setProperty("setOnHoverBrush",           QBrush(QColor(Qt::red)));
            widget.setProperty("setOnClickBrush",           QBrush(QColor(Qt::red)));
            widget.setProperty("setChildrenOnDefaultBrush", QBrush(QColor(Qt::red)));
            widget.setProperty("setChildrenOnHoverBrush",   QBrush(QColor(Qt::red)));
            widget.setProperty("setChildrenOnClickBrush",   QBrush(QColor(Qt::red)));
            widget.setProperty("setChildrenOnDisableBrush", QBrush(QColor(Qt::red)));
            widget.setProperty("setDefaultPen",             QPen(QColor(Qt::red)));
            widget.setProperty("setDisablePen",             QPen(QColor(Qt::red)));
            widget.setProperty("setHoverPen",               QPen(QColor(Qt::red)));
            widget.setProperty("setClickPen",               QPen(QColor(Qt::red)));
            widget.setProperty("setOnDefaultPen",           QPen(QColor(Qt::red)));
            widget.setProperty("setOnHoverPen",             QPen(QColor(Qt::red)));
            widget.setProperty("setOnClickPen",             QPen(QColor(Qt::red)));
            style.drawPrimitive(QStyle::PE_IndicatorRadioButton, &radioButtonOption, &painter, &widget);


            // 可以添加检查绘制结果的逻辑，例如使用 QImage 捕获绘制结果，检查颜色、形状等
        }

        // 测试 PE_IndicatorCheckBox
        {
            QStyleOptionButton checkBoxOption;
            checkBoxOption.rect = QRect(0, 0, 100, 100);
            checkBoxOption.state = QStyle::State_None;
            checkBoxOption.palette = widget.palette();
            checkBoxOption.direction = Qt::LeftToRight;

            widget.setProperty("setRadius", 1);
            widget.setProperty("setDefaultBrush",       QBrush(QColor(Qt::red)));
            widget.setProperty("setHoverBrush",         QBrush(QColor(Qt::red)));
            widget.setProperty("setClickBrush",         QBrush(QColor(Qt::red)));
            widget.setProperty("setDisableBrush",       QBrush(QColor(Qt::red)));
            widget.setProperty("setOnDefaultBrush",     QBrush(QColor(Qt::red)));
            widget.setProperty("setOnHoverBrush",       QBrush(QColor(Qt::red)));
            widget.setProperty("setOnClickBrush",       QBrush(QColor(Qt::red)));
            widget.setProperty("setPathDisableBrush",   QBrush(QColor(Qt::red)));
            widget.setProperty("setPathBrush",          QBrush(QColor(Qt::red)));
            widget.setProperty("setContentPen",         QPen(QColor(Qt::red)));
            widget.setProperty("setDefaultPen",         QPen(QColor(Qt::red)));
            widget.setProperty("setDisablePen",         QPen(QColor(Qt::red)));
            widget.setProperty("setHoverPen",           QPen(QColor(Qt::red)));
            widget.setProperty("setClickPen",           QPen(QColor(Qt::red)));
            widget.setProperty("setOnDefaultPen",       QPen(QColor(Qt::red)));
            widget.setProperty("setOnHoverPen",         QPen(QColor(Qt::red)));
            widget.setProperty("setOnClickPen",         QPen(QColor(Qt::red)));
            widget.setProperty("setOnHoverBrushIslinearGradient",         true);

            style.drawPrimitive(QStyle::PE_IndicatorCheckBox, &checkBoxOption, &painter, &widget);
            // 可以添加检查绘制结果的逻辑，例如使用 QImage 捕获绘制结果，检查颜色、形状等
        }

        // 测试 PE_IndicatorTabTearLeft
        {
            QStyleOption option;
            option.rect = QRect(0, 0, 100, 100);
            option.state = QStyle::State_None;
            option.palette = widget.palette();
            option.direction = Qt::LeftToRight;
            style.drawPrimitive(QStyle::PE_IndicatorTabTearLeft, &option, &painter, &widget);
            // 可以添加检查绘制结果的逻辑，例如使用 QImage 捕获绘制结果，检查颜色、形状等
        }

        // 测试 PE_IndicatorTabTearRight
        {
            QStyleOption option;
            option.rect = QRect(0, 0, 100, 100);
            option.state = QStyle::State_None;
            option.palette = widget.palette();
            option.direction = Qt::LeftToRight;
            style.drawPrimitive(QStyle::PE_IndicatorTabTearRight, &option, &painter, &widget);
            // 可以添加检查绘制结果的逻辑，例如使用 QImage 捕获绘制结果，检查颜色、形状等
        }

        // 测试 PE_PanelScrollAreaCorner
        {
            QStyleOption option;
            option.rect = QRect(0, 0, 100, 100);
            option.state = QStyle::State_None;
            option.palette = widget.palette();
            option.direction = Qt::LeftToRight;
            style.drawPrimitive(QStyle::PE_PanelScrollAreaCorner, &option, &painter, &widget);
            // 可以添加检查绘制结果的逻辑，例如使用 QImage 捕获绘制结果，检查颜色、形状等
        }
    }
    void testmenustyle()
    {
        // 创建 UKUIConfigStyle 实例
        UKUIConfigStyle configStyle("Menustyle");
        // 创建 QPainter 实例，这里使用 QImage 作为绘图设备
        QImage image(200, 200, QImage::Format_ARGB32);
        QPainter painter(&image);
        // 创建 QStyleOption 实例
        QStyleOption option;
        // 创建 QWidget 实例
        QWidget widget;
        // 测试 QStyle::PE_PanelMenu 情况
        configStyle.drawPrimitive(QStyle::PE_PanelMenu, &option, &painter, &widget);
        // 测试 QStyle::PE_FrameMenu 情况
        configStyle.drawPrimitive(QStyle::PE_FrameMenu, &option, &painter, &widget);
        // 测试 sp->initConfigMenuParameters
        UKUIConfigStyleSpace::UKUIConfigStyleParameters *sp = new UKUIConfigStyleSpace::UKUIConfigStyleParameters(nullptr, true, "testCfg");

        sp->updateParameters(true);
        sp->colorIsSame(Qt::red, Qt::blue);
//        configStyle.sp = sp;
        // 测试保存和恢复 painter 状态
        painter.save();
        painter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
        painter.setBrush(Qt::red);
        painter.setPen(Qt::blue);
            painter.drawRoundedRect(widget.rect(), 10, 10);
        painter.restore();


        // 测试 Menu_Right_Bottom_Corner 为 true 的情况
        sp->Menu_Right_Bottom_Corner = true;


        QRect drawRect;
        drawRect = option.rect.adjusted(0, 0, 1, 1);
        QPainterPath drawRightBottomPath;
        drawRightBottomPath.moveTo(drawRect.right(), drawRect.bottom() - 28);
        drawRightBottomPath.arcTo(QRect(drawRect.right() - 2 * 20, drawRect.bottom() - 2 * 28, 2 * 20, 2 * 28), 0, -90);
        drawRightBottomPath.lineTo(drawRect.right() - 10, drawRect.bottom());
        drawRightBottomPath.arcTo(QRect(drawRect.right() - 2 * 10, drawRect.bottom() - 2 * 10, 2 * 10, 2 * 10), -90, 90);
        drawRightBottomPath.lineTo(drawRect.right(), drawRect.bottom() - 28);


        QColor startColor = option.palette.color(QPalette::Active, QPalette::Base).lighter(300);
        QColor endColor = option.palette.color(QPalette::Active, QPalette::Base).lighter(300);
        QLinearGradient linearGradient;


        painter.save();
        linearGradient.setColorAt(0, startColor);
        linearGradient.setColorAt(1, endColor);
        linearGradient.setStart(drawRect.right(), drawRect.bottom() - 28);
        linearGradient.setFinalStop(drawRect.right(), drawRect.bottom());
        painter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
        painter.setPen(Qt::transparent);
        painter.setBrush(linearGradient);
        painter.drawPath(drawRightBottomPath);
        painter.restore();


        // 清理资源
        delete sp;
    }
    void testEventFilter()
    {
        UKUIConfigStyle style("EventFilterstyle");
        QObject obj;
        QEvent event(QEvent::None);
//        QApplication app(argc, argv);  // 假设你已经在 main 函数中定义了 argc 和 argv

        // 测试 QEvent::StyleAnimationUpdate 事件的处理
        {
            QEvent styleAnimationUpdateEvent(QEvent::StyleAnimationUpdate);
            bool result = style.eventFilter(&obj, &styleAnimationUpdateEvent);
            // 可以添加检查 result 的逻辑，例如 QVERIFY(result == true);
        }

        // 测试 QPushButton 和 QToolButton 的 QEvent::Hide 事件处理
        {
            QPushButton pushButton;
            QToolButton toolButton;
            QEvent hideEvent(QEvent::Hide);
            // 对于 QPushButton
            bool pushButtonResult = style.eventFilter(&pushButton, &hideEvent);
            // 对于 QToolButton
            bool toolButtonResult = style.eventFilter(&toolButton, &hideEvent);
            // 可以添加检查 pushButtonResult 和 toolButtonResult 的逻辑，例如 QVERIFY(pushButtonResult == false);
        }

        // 测试 QTipLabel 的事件处理
        {
            QLabel tipLabel;
            tipLabel.setAlignment(Qt::AlignLeft);
            QEvent someEvent(QEvent::None);
            style.eventFilter(&tipLabel, &someEvent);
            // 可以添加检查 tipLabel 的对齐方式是否被修改的逻辑，例如 QVERIFY(tipLabel.alignment() == Qt::AlignVCenter);
        }

        // 测试 QSlider 的 QEvent::Wheel 事件处理
        {
            QSlider slider(Qt::Horizontal);
            QWheelEvent wheelEvent(QPoint(0, 0), 0, Qt::NoButton, Qt::NoModifier);
            bool wheelEventResult = style.eventFilter(&slider, &wheelEvent);
            // 可以添加检查 wheelEventResult 的逻辑，例如 QVERIFY(wheelEventResult == false);
        }

        // 测试 QSlider 的 QEvent::MouseButtonPress 事件处理
        {
            QSlider slider(Qt::Horizontal);
            QMouseEvent mousePressEvent(QEvent::MouseButtonPress, QPoint(0, 0), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
            bool mousePressEventResult = style.eventFilter(&slider, &mousePressEvent);
            // 可以添加检查 mousePressEventResult 的逻辑，例如 QVERIFY(mousePressEventResult == false);
        }

        // 测试 QScrollBar 的事件处理
        {
            QScrollBar scrollBar(Qt::Horizontal);
            QMouseEvent mousePressEvent(QEvent::MouseButtonPress, QPoint(0, 0), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
            bool scrollBarMouseEventResult = style.eventFilter(&scrollBar, &mousePressEvent);
            // 可以添加检查 scrollBarMouseEventResult 的逻辑，例如 QVERIFY(scrollBarMouseEventResult == false);
        }

        // 测试 QMenu 的 QEvent::Show 事件处理
        {
            QMenu menu;
            QEvent showEvent(QEvent::Show);
            bool menuShowEventResult = style.eventFilter(&menu, &showEvent);
            // 可以添加检查 menuShowEventResult 的逻辑，例如 QVERIFY(menuShowEventResult == false);
        }
    }
    void testShadowHelper(){
        // 创建 ConfigShadowHelper 对象
        UKUIConfigStyleSpace::ConfigShadowHelper shadowHelper(nullptr);


        // 测试 isWidgetNeedDecoShadow 函数
        QWidget* testWidget1 = new QWidget();
        bool needShadow1 = shadowHelper.isWidgetNeedDecoShadow(testWidget1);
        qDebug() << "isWidgetNeedDecoShadow result for default QWidget: " << needShadow1;


        // 测试 registerWidget 函数
        shadowHelper.registerWidget(testWidget1);
        qDebug() << "registerWidget called for default QWidget.";


        // 测试 getShadowPixmap 函数
        QColor testColor(255, 0, 0);
        int shadowBorder = 5;
        qreal darkness = 0.8;
        QWidget* testWidget2 = new QWidget();
        int borderRadiusTopLeft = 10;
        int borderRadiusTopRight = 10;
        int borderRadiusBottomLeft = 10;
        int borderRadiusBottomRight = 10;
        QPixmap pixmap = shadowHelper.getShadowPixmap(testColor, shadowBorder, darkness, testWidget2, borderRadiusTopLeft, borderRadiusTopRight, borderRadiusBottomLeft, borderRadiusBottomRight);
        qDebug() << "getShadowPixmap result size: " << pixmap.size();


        // 测试 caculateRelativePainterPath 函数
        QPainterPath path = shadowHelper.caculateRelativePainterPath(testWidget2, borderRadiusTopLeft, borderRadiusTopRight, borderRadiusBottomLeft, borderRadiusBottomRight);
        qDebug() << "caculateRelativePainterPath result containsElement: " << path.contains(QPointF(0, 0));


        // 测试 getShadow 函数
        KWindowShadow* shadow = shadowHelper.getShadow(testColor, shadowBorder, darkness, testWidget2, borderRadiusTopLeft, borderRadiusTopRight, borderRadiusBottomLeft, borderRadiusBottomRight);
        qDebug() << "getShadow function called.";


        // 测试 eventFilter 函数
        QEvent* showEvent = new QEvent(QEvent::Show);
        bool filterResult = shadowHelper.eventFilter(testWidget1, showEvent);
        qDebug() << "eventFilter result for Show event: " << filterResult;


        // 测试 unregisterWidget 函数
        shadowHelper.unregisterWidget(testWidget1);
        qDebug() << "unregisterWidget called for default QWidget.";


        // 额外测试，使用具有特定属性的 QWidget 进行测试
        QWidget* customWidget = new QWidget();
        customWidget->setProperty("useCustomShadow", true);
        customWidget->setProperty("customShadowWidth", 8);
        customWidget->setProperty("customShadowDarkness", 0.6);
        QVector4D radius(12, 12, 12, 12);
        customWidget->setProperty("customShadowRadius", radius);
        QVector4D margins(5, 5, 5, 5);
        customWidget->setProperty("customShadowMargins", margins);


        // 重新测试 registerWidget 函数
        shadowHelper.registerWidget(customWidget);
        qDebug() << "registerWidget called for custom QWidget.";


        // 重新测试 isWidgetNeedDecoShadow 函数
        bool needShadow2 = shadowHelper.isWidgetNeedDecoShadow(customWidget);
        qDebug() << "isWidgetNeedDecoShadow result for custom QWidget: " << needShadow2;


        // 重新测试 eventFilter 函数
        QEvent* customShowEvent = new QEvent(QEvent::Show);
        filterResult = shadowHelper.eventFilter(customWidget, customShowEvent);
        qDebug() << "eventFilter result for custom QWidget Show event: " << filterResult;


        // 重新测试 unregisterWidget 函数
        shadowHelper.unregisterWidget(customWidget);
        qDebug() << "unregisterWidget called for custom QWidget.";


        // 清理内存
        delete testWidget1;
        delete testWidget2;
        delete customWidget;
        delete showEvent;
        delete customShowEvent;
        if (shadow) {
            shadow->destroy();
            delete shadow;
        }
    }
    void testConfigP() {

        ReadConfig readcf("/usr/share/qt5-ukui-platformtheme/themeconfig/fashion.json");
        readcf.load("/usr/share/qt5-ukui-platformtheme/themeconfig/fashion.json");
        QBrush b;
        readcf.getColorValue(b, "LightTheme", "PushButton", "DefaultPushButton", "DefaultBrush", "");

        readcf.getColorValue(b, "LightTheme", "Palette", "WindowText_at", "", "");
        readcf.getColorValue(b, "LightTheme", "PushButton", "", "", "");
        readcf.getColorValue(b, "LightTheme", "PushButton", "DefaultPushButton", "", "");
        readcf.getColorValue(b, "LightTheme", "PushButton", "DefaultPushButton", "DefaultBrush", "");

        readcf.setValue("PushButton", "DefaultPushButton");
        ReadThemeConfig themecf("/usr/share/qt5-ukui-platformtheme/themeconfig/fashion.json");
        themecf.setRadius("2123", 1);


        QList<QColor> l;
        readcf.getGradientValue(l, "LightTheme", "PushButton", "WindowCloseButton", "HoverBrush", "");

        readcf.stringToPaletteColor("WindowText_at"            );
        readcf.stringToPaletteColor("WindowText_iat"            );
        readcf.stringToPaletteColor("WindowText_dis"           );
        readcf.stringToPaletteColor("Button_at"           );
        readcf.stringToPaletteColor("Button_iat"            );
        readcf.stringToPaletteColor("Button_dis"            );
        readcf.stringToPaletteColor("Light_at"            );
        readcf.stringToPaletteColor("Light_iat"            );
        readcf.stringToPaletteColor("Light_dis"            );
        readcf.stringToPaletteColor("Midlight_at"            );
        readcf.stringToPaletteColor("Midlight_iat"            );
        readcf.stringToPaletteColor("Midlight_dis"            );


        readcf.stringToPaletteColor("Dark_at"         );
        readcf.stringToPaletteColor("Dark_iat"          );
        readcf.stringToPaletteColor("Dark_dis"         );
        readcf.stringToPaletteColor("Mid_at"    );
        readcf.stringToPaletteColor("Mid_iat"      );
        readcf.stringToPaletteColor("Mid_dis"      );
        readcf.stringToPaletteColor("Text_at"    );
        readcf.stringToPaletteColor("Text_iat"     );
        readcf.stringToPaletteColor("Text_dis"     );
        readcf.stringToPaletteColor("BrightText_at"       );
        readcf.stringToPaletteColor("BrightText_iat"        );
        readcf.stringToPaletteColor("BrightText_dis"        );


        readcf.stringToPaletteColor("ButtonText_at"  );
        readcf.stringToPaletteColor("ButtonText_iat" );
        readcf.stringToPaletteColor("ButtonText_dis" );
        readcf.stringToPaletteColor("Base_at"        );
        readcf.stringToPaletteColor("Base_iat"       );
        readcf.stringToPaletteColor("Base_dis"       );
        readcf.stringToPaletteColor("Window_at"      );
        readcf.stringToPaletteColor("Window_iat"     );
        readcf.stringToPaletteColor("Window_dis"     );
        readcf.stringToPaletteColor("Shadow_at"      );
        readcf.stringToPaletteColor("Shadow_iat"     );
        readcf.stringToPaletteColor("Shadow_dis"     );

        readcf.stringToPaletteColor("HighLight_at" );
        readcf.stringToPaletteColor("HighLight_iat" );
        readcf.stringToPaletteColor("HighLight_dis" );
        readcf.stringToPaletteColor("HighLightText_at" );
        readcf.stringToPaletteColor("HighLightText_iat" );
        readcf.stringToPaletteColor("HighLightText_dis" );
        readcf.stringToPaletteColor("Link_at" );
        readcf.stringToPaletteColor("Link_iat" );
        readcf.stringToPaletteColor("Link_dis" );
        readcf.stringToPaletteColor("LinkVisited_at" );
        readcf.stringToPaletteColor("LinkVisited_iat" );
        readcf.stringToPaletteColor("LinkVisited_dis" );


        readcf.stringToPaletteColor("AlternateBase_at" );
        readcf.stringToPaletteColor("AlternateBase_iat" );
        readcf.stringToPaletteColor("AlternateBase_dis" );
        readcf.stringToPaletteColor("NoRole_at" );
        readcf.stringToPaletteColor("NoRole_iat" );
        readcf.stringToPaletteColor("NoRole_dis" );
        readcf.stringToPaletteColor("ToolTipBase_at" );
        readcf.stringToPaletteColor("ToolTipBase_iat" );
        readcf.stringToPaletteColor("ToolTipBase_dis" );
        readcf.stringToPaletteColor("ToolTipText_at" );
        readcf.stringToPaletteColor("ToolTipText_iat" );
        readcf.stringToPaletteColor("ToolTipText_dis" );


        readcf.stringToPaletteColor("PlaceholderText_at");
        readcf.stringToPaletteColor("PlaceholderText_iat" );
        readcf.stringToPaletteColor("PlaceholderText_dis" );


        // 创建 UKUIConfigStyleParameters 对象
        UKUIConfigStyleSpace::UKUIConfigStyleParameters params(nullptr, true, "testCfg");
        // 测试 lanhuHSLToQtHsl 函数
        QColor result1 = params.lanhuHSLToQtHsl(120, 50, 70, 200);
        qDebug() << "lanhuHSLToQtHsl result: " << result1;
        // 测试 adjustColor 函数
        QColor color1(255, 0, 0); // 红色
        QColor result2 = params.adjustColor(color1, 10, 20, 30, 40);
        qDebug() << "adjustColor result: " << result2;
        // 测试 adjustH 函数
        QColor result3 = params.adjustH(color1, 50);
        qDebug() << "adjustH result: " << result3;
        // 测试 adjustS 函数
        QColor result4 = params.adjustS(color1, 30);
        qDebug() << "adjustS result: " << result4;
        // 测试 adjustL 函数
        QColor result5 = params.adjustL(color1, 40);
        qDebug() << "adjustL result: " << result5;
        // 测试 adjustA 函数
        QColor result6 = params.adjustA(color1, 25);
        qDebug() << "adjustA result: " << result6;
        // 测试 highlightClick 函数
        QPalette palette;
        QColor result7 = params.highlightClick(true, palette);
        qDebug() << "highlightClick (isDark = true) result: " << result7;
        QColor result8 = params.highlightClick(false, palette);
        qDebug() << "highlightClick (isDark = false) result: " << result8;
        // 测试 highlightHover 函数
        QColor result9 = params.highlightHover(true, palette);
        qDebug() << "highlightHover (isDark = true) result: " << result9;
        QColor result10 = params.highlightHover(false, palette);
        qDebug() << "highlightHover (isDark = false) result: " << result10;
        // 测试 buttonDarkClick 函数
        QColor result11 = params.buttonDarkClick(true, palette);
        qDebug() << "buttonDarkClick (isDark = true) result: " << result11;
        QColor result12 = params.buttonDarkClick(false, palette);
        qDebug() << "buttonDarkClick (isDark = false) result: " << result12;
        // 测试 normalButtonColor 函数
        QPen defaultPen, hoverPen, clickPen, disablePen;
        QBrush defaultBrush, hoverBrush, clickBrush, disableBrush;
        params.normalButtonColor(true, palette, defaultPen, defaultBrush, hoverPen, hoverBrush, clickPen, clickBrush, disablePen, disableBrush);
        qDebug() << "normalButtonColor (isDark = true) executed";
        params.normalButtonColor(false, palette, defaultPen, defaultBrush, hoverPen, hoverBrush, clickPen, clickBrush, disablePen, disableBrush);
        qDebug() << "normalButtonColor (isDark = false) executed";
    }

    void testBlackList(){
        QStringList blackApp = blackAppList();
        qDebug() << "blackAppList:";
        for (const QString& app : blackApp) {
            qDebug() << app;
        }
        // 测试 blackAppListWithBlurHelper 函数
        QStringList blackAppBlur = blackAppListWithBlurHelper();
        qDebug() << "blackAppListWithBlurHelper:";
        for (const QString& app : blackAppBlur) {
            qDebug() << app;
        }
        // 测试 useDarkPaletteList 函数
        QStringList darkPalette = useDarkPaletteList();
        qDebug() << "useDarkPaletteList:";
        for (const QString& app : darkPalette) {
            qDebug() << app;
        }
        // 测试 useDefaultPaletteList 函数
        QStringList defaultPalette = useDefaultPaletteList();
        qDebug() << "useDefaultPaletteList:";
        for (const QString& app : defaultPalette) {
            qDebug() << app;
        }
        // 测试 useTransparentButtonList 函数
        QStringList transparentButton = useTransparentButtonList();
        qDebug() << "useTransparentButtonList:";
        for (const QString& app : transparentButton) {
            qDebug() << app;
        }
        // 测试 focusStateActiveList 函数
        QStringList focusState = focusStateActiveList();
        qDebug() << "focusStateActiveList:";
        for (const QString& app : focusState) {
            qDebug() << app;
        }
        // 测试 windowManageBlackList 函数
        QStringList windowManage = windowManageBlackList();
        qDebug() << "windowManageBlackList:";
        for (const QString& app : windowManage) {
            qDebug() << app;
        }
    }


    void testFileDialog(){

        UKUIFileDialog::KyNativeFileDialog kf;
        kf.getCurrentAllFileUris();
        kf.getCurrentSelectionFileInfos();
        kf.setCurrentSortOrder(Qt::AscendingOrder);
        kf.setCurrentSortColumn(0);
        kf.editUri("11");
        kf.editUris(QStringList("1111"));
        kf.selectNameFilterIndex();
        kf.setLabelText(QFileDialog::Accept, "ok");
        kf.labelText(QFileDialog::Accept);
        kf.setOptions(QFileDialog::HideNameFilterDetails);
        kf.setOption(QFileDialog::HideNameFilterDetails, true);
        kf.options();
        kf.setCurrentInputName("");

        UKUIFileDialog::FileDialogSideBar bar;
        UKUIFileDialog::SideBarStyle *style = UKUIFileDialog::SideBarStyle::getStyle();
        bar.setStyle(style);
        {
            QWidget widget;
            widget.setProperty("normalRadius", 8);
            QPainter painter;
            QStyleOption option;
            option.rect = QRect(0, 0, 100, 100);
            option.state = QStyle::State_None;
            option.palette = qApp->style()->standardPalette();
            option.direction = Qt::LeftToRight;
            style->drawPrimitive(QStyle::PE_PanelMenu, &option, &painter, &widget);
            style->drawPrimitive(QStyle::PE_IndicatorItemViewItemDrop, &option, &painter, &widget);
            QStyleOptionViewItem iOption;
            iOption.rect = QRect(0, 0, 100, 100);
            iOption.state = QStyle::State_None;
            iOption.palette = qApp->style()->standardPalette();
            iOption.direction = Qt::LeftToRight;
            style->drawPrimitive(QStyle::PE_IndicatorBranch, &iOption, &painter, &widget);
            style->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, &painter, &widget);
            style->drawControl(QStyle::CE_ItemViewItem, &iOption, &painter, &widget);

        }
        bar.tableModeChanged("");
        bar.menuRequest(QPoint(0,0));
//        QWindow *w1 = new QWindow();
        UKUIFileDialog::KyFileDialogHelper*help = new UKUIFileDialog::KyFileDialogHelper();
        help->defaultNameFilterDisables();
        help->setDirectory(QUrl("/usr/share/qt5-ukui-platformtheme/themeconfig"));
        QString list;
        list.append("桌面文件(*.desktop)");
        help->selectNameFilter(list);
        help->selectMimeTypeFilter("application/icon");
        help->selectedMimeTypeFilter();
//        bool ishow = help->isShow();
//        help->show(Qt::Widget,Qt::ApplicationModal,w1);
        QWidget *w1 = new QWidget();
//        QFileDialog *a = new QFileDialog(w1);
//        UKUIFileDialog::KyNativeFileDialog *a = new UKUIFileDialog::KyNativeFileDialog(w1);
////        a->setDirectory(QString("file://%1").arg(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)));
//        a->setViewMode(UKUIFileDialog::KyNativeFileDialog::List);
//        a->setAcceptMode(QFileDialog::AcceptSave);
//        a->setCurrentInputName("test");
//        a->setLabelText(QFileDialog::FileName, "test");

////        QStringList nameFilters;
////        nameFilters << "txt";
////        nameFilters << "*";
////        a->setNameFilters(nameFilters);

//        a->show();

        QStringList mimeTypeFilters({"image/jpeg", // will show "JPEG image (*.jpeg *.jpg *.jpe)
                                     "image/png",  // will show "PNG image (*.png)"
                                     "application/octet-stream" // will show "All files (*)"
                                    });

        QWidget *w = new QWidget();
        QFileDialog *dialog00 = new QFileDialog(w);
        dialog00->setMimeTypeFilters(mimeTypeFilters);
        dialog00->show();
        qApp->setProperty("Language", "zh_CN");

        QFileDialog *dialog01 = new QFileDialog();
        dialog01->setDirectoryUrl(QUrl("file://home/tanjing/work"));
        QString filters = tr("Image(*.png) ;; Image(*.jpg)");

        dialog01->setNameFilter(filters);
        dialog01->setViewMode(QFileDialog::Detail);
//        dialog01->show();
//dialog01->close();
        QFileDialog *dialog02 = new QFileDialog();
        dialog02->setAcceptMode(QFileDialog::AcceptSave);

        dialog02->setNameFilter(filters);
        dialog02->setViewMode(QFileDialog::Detail);
//        dialog02->show();
//dialog02->close();
        QFileDialog::getOpenFileName(nullptr, tr("getOpenFileName"), QStandardPaths::writableLocation(QStandardPaths::HomeLocation), tr("Image Files (*.png *.jpg *.bmp);;Text files(*.txt);;XML files(*.xml)"));
        QFileDialog::getOpenFileNames(nullptr, QStandardPaths::writableLocation(QStandardPaths::HomeLocation), tr("getOpenFileNames"));
        QFileDialog::getSaveFileName(nullptr, tr("getSaveFileName"), "/home", tr("Image Files (*.png *.jpg *.bmp);;Text files(*.txt);;XML files(*.xml)"));
        QFileDialog::getSaveFileUrl(nullptr, tr("getSaveFileUrl"),QUrl(), tr("Image Files (*.png *.jpg *.bmp)"));
        QFileDialog::getExistingDirectory(nullptr, tr("getExistingDirectory"));
        QFileDialog::getExistingDirectoryUrl(nullptr, tr("getExistingDirectoryUrl"));

    }


};

// 定义测试用例入口点setSkipEffect
QTEST_MAIN(LibFunctionTest)

#include "test-settings.moc"

