/*
* Copyright (C) 2019 ~ 2020 Deepin Technology Co., Ltd.
*
* Author:     zhangyunfeng <zhangyunfeng@uniontech.com>
* Maintainer: zhangyunfeng <zhangyunfeng@uniontech.com>
*
* 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
* 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 <http://www.gnu.org/licenses/>.
*/

#include "ut_videowidget.h"

#define protected public
#define private public
#include "videowidget.h"
#undef private
#undef protected

#include <QUrl>
#include <QResizeEvent>
#include <QKeyEvent>
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
#include <QEnterEvent>
#endif

ut_videowidget_test::ut_videowidget_test()
{

}

TEST_F(ut_videowidget_test, DISABLED_VideoWidget)
{
    VideoWidget* test_module = new VideoWidget(QUrl());
    ASSERT_TRUE(test_module);
    ASSERT_TRUE(test_module->m_video);
    test_module->deleteLater();
}

TEST_F(ut_videowidget_test, DISABLED_updateBigIcon)
{
    VideoWidget* test_module = new VideoWidget(QUrl());
    test_module->updateBigIcon();
    test_module->deleteLater();
}

TEST_F(ut_videowidget_test, DISABLED_updateSmallIcon)
{
    VideoWidget* test_module = new VideoWidget(QUrl());
    test_module->updateSmallIcon();
    test_module->deleteLater();
}

TEST_F(ut_videowidget_test, DISABLED_updateSelectBtnPos)
{
    VideoWidget* test_module = new VideoWidget(QUrl());
    test_module->updateSelectBtnPos();
    test_module->deleteLater();
}

TEST_F(ut_videowidget_test, DISABLED_stopBeforeDestroy)
{
    VideoWidget* test_module = new VideoWidget(QUrl());
    test_module->stopBeforeDestroy();
    test_module->deleteLater();
}

TEST_F(ut_videowidget_test, DISABLED_resizeEvent)
{
    VideoWidget* test_module = new VideoWidget(QUrl());
    QResizeEvent *e = new QResizeEvent(QSize(100, 100), QSize(50, 50));
    test_module->resizeEvent(e);
    delete e;
    test_module->deleteLater();
}

TEST_F(ut_videowidget_test, DISABLED_keyPressEvent)
{
    VideoWidget* test_module = new VideoWidget(QUrl());
    QKeyEvent keyEvent(QEvent::Type::KeyPress, Qt::Key_Enter, Qt::KeyboardModifier::NoModifier);
    test_module->keyPressEvent(&keyEvent);

    QKeyEvent keyEvent1(QEvent::Type::KeyPress, Qt::Key_Return, Qt::KeyboardModifier::NoModifier);
    test_module->keyPressEvent(&keyEvent1);
    test_module->deleteLater();
}

TEST_F(ut_videowidget_test, DISABLED_enterEvent)
{
    VideoWidget* test_module = new VideoWidget(QUrl());
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
    QEnterEvent *e = new QEnterEvent(QPointF(0, 0), QPointF(0, 0), QPointF(0, 0));
#else
    QEvent *e = new QEvent(QEvent::Enter);
#endif
    test_module->enterEvent(e);
    delete e;
    test_module->deleteLater();
}

TEST_F(ut_videowidget_test, DISABLED_leaveEvent)
{
    VideoWidget* test_module = new VideoWidget(QUrl());
    QEvent *e = new QEvent(QEvent::Leave);
    test_module->leaveEvent(e);
    delete e;
    test_module->deleteLater();
}
