1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-09-18 08:22:33 +02:00

Fix tst_ScreenPlay

This commit is contained in:
Elias Steurer 2022-04-23 18:00:12 +02:00
parent bb700780ef
commit 50f198050d
41 changed files with 106 additions and 102 deletions

View File

@ -5,7 +5,7 @@ set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
set(SOURCES set(SOURCES
app.cpp src/app.cpp
src/create.cpp src/create.cpp
src/createimportvideo.cpp src/createimportvideo.cpp
src/globalvariables.cpp src/globalvariables.cpp
@ -23,24 +23,24 @@ set(SOURCES
src/wizards.cpp) src/wizards.cpp)
set(HEADER set(HEADER
app.h inc/public/ScreenPlay/app.h
src/create.h inc/public/ScreenPlay/create.h
src/createimportstates.h inc/public/ScreenPlay/createimportstates.h
src/createimportvideo.h inc/public/ScreenPlay/createimportvideo.h
src/globalvariables.h inc/public/ScreenPlay/globalvariables.h
src/installedlistfilter.h inc/public/ScreenPlay/installedlistfilter.h
src/installedlistmodel.h inc/public/ScreenPlay/installedlistmodel.h
src/monitorlistmodel.h inc/public/ScreenPlay/monitorlistmodel.h
src/profile.h inc/public/ScreenPlay/profile.h
src/profilelistmodel.h inc/public/ScreenPlay/profilelistmodel.h
src/projectsettingslistmodel.h inc/public/ScreenPlay/projectsettingslistmodel.h
src/screenplaymanager.h inc/public/ScreenPlay/screenplaymanager.h
src/screenplaywallpaper.h inc/public/ScreenPlay/screenplaywallpaper.h
src/screenplaywidget.h inc/public/ScreenPlay/screenplaywidget.h
src/sdkconnection.h inc/public/ScreenPlay/sdkconnection.h
src/settings.h inc/public/ScreenPlay/settings.h
src/util.h inc/public/ScreenPlay/util.h
src/wizards.h) inc/public/ScreenPlay/wizards.h)
set(QML set(QML
main.qml main.qml
@ -141,6 +141,11 @@ add_library(
${RESOURCES} ${RESOURCES}
${FONTS}) ${FONTS})
target_include_directories(
ScreenPlayLib
PUBLIC inc/public/
PRIVATE src/)
target_link_libraries( target_link_libraries(
ScreenPlayLib ScreenPlayLib
PUBLIC ScreenPlaySDK PUBLIC ScreenPlaySDK
@ -158,10 +163,17 @@ target_link_libraries(
ScreenPlayWorkshopplugin ScreenPlayWorkshopplugin
ScreenPlayWorkshop ScreenPlayWorkshop
SteamSDKQtEnums) SteamSDKQtEnums)
target_include_directories(ScreenPlayLib PUBLIC )
qt_add_executable(${PROJECT_NAME} main.cpp) qt_add_executable(${PROJECT_NAME} main.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE ScreenPlayLib) target_link_libraries(${PROJECT_NAME} PRIVATE ScreenPlayLib)
if(${SCREENPLAY_TESTS})
add_executable(tst_ScreenPlay tests/tst_main.cpp)
target_link_libraries(tst_ScreenPlay PRIVATE ScreenPlayLib Qt6::Test)
endif()
set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/translations") set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/translations")
# qt_add_lupdate does not work for some reason. Lets do it manually: # qt_add_lupdate does not work for some reason. Lets do it manually:
@ -188,11 +200,6 @@ qt_add_qml_module(
QML_FILES QML_FILES
${QML}) ${QML})
#if(${SCREENPLAY_TESTS})
# add_executable(tst_ScreenPlay tests/tst_main.cpp)
# target_link_libraries(tst_ScreenPlay PRIVATE ScreenPlayLib Qt6::Test)
#endif()
if(WIN32) if(WIN32)
# Icon # Icon
target_sources(${PROJECT_NAME} PRIVATE ScreenPlay.rc) target_sources(${PROJECT_NAME} PRIVATE ScreenPlay.rc)

View File

@ -49,16 +49,16 @@
#include <QtQml> #include <QtQml>
#include <QtSvg> #include <QtSvg>
#include "src/create.h" #include "ScreenPlay/create.h"
#include "src/globalvariables.h" #include "ScreenPlay/globalvariables.h"
#include "src/installedlistfilter.h" #include "ScreenPlay/installedlistfilter.h"
#include "src/installedlistmodel.h" #include "ScreenPlay/installedlistmodel.h"
#include "src/monitorlistmodel.h" #include "ScreenPlay/monitorlistmodel.h"
#include "src/profilelistmodel.h" #include "ScreenPlay/profilelistmodel.h"
#include "src/screenplaymanager.h" #include "ScreenPlay/screenplaymanager.h"
#include "src/settings.h" #include "ScreenPlay/settings.h"
#include "src/util.h" #include "ScreenPlay/util.h"
#include "src/wizards.h" #include "ScreenPlay/wizards.h"
#include <memory> #include <memory>
#include <sentry.h> #include <sentry.h>

View File

@ -57,9 +57,9 @@
#include <memory> #include <memory>
#include "ScreenPlayUtil/util.h" #include "ScreenPlayUtil/util.h"
#include "createimportvideo.h" #include "ScreenPlay/createimportvideo.h"
#include "globalvariables.h" #include "ScreenPlay/globalvariables.h"
#include "util.h" #include "ScreenPlay/util.h"
namespace ScreenPlay { namespace ScreenPlay {

View File

@ -49,8 +49,8 @@
#include <QString> #include <QString>
#include <QtMath> #include <QtMath>
#include "createimportstates.h" #include "ScreenPlay/createimportstates.h"
#include "util.h" #include "ScreenPlay/util.h"
namespace ScreenPlay { namespace ScreenPlay {

View File

@ -38,8 +38,8 @@
#include <QSortFilterProxyModel> #include <QSortFilterProxyModel>
#include <memory> #include <memory>
#include "globalvariables.h" #include "ScreenPlay/globalvariables.h"
#include "installedlistmodel.h" #include "ScreenPlay/installedlistmodel.h"
namespace ScreenPlay { namespace ScreenPlay {

View File

@ -55,9 +55,9 @@
#include <QtConcurrent/QtConcurrent> #include <QtConcurrent/QtConcurrent>
#include "ScreenPlayUtil/projectfile.h" #include "ScreenPlayUtil/projectfile.h"
#include "globalvariables.h" #include "ScreenPlay/globalvariables.h"
#include "profilelistmodel.h" #include "ScreenPlay/profilelistmodel.h"
#include "util.h" #include "ScreenPlay/util.h"
#include <memory> #include <memory>

View File

@ -43,9 +43,9 @@
#include <QString> #include <QString>
#include <QVector> #include <QVector>
#include "projectsettingslistmodel.h" #include "ScreenPlay/projectsettingslistmodel.h"
#include "screenplaywallpaper.h" #include "ScreenPlay/screenplaywallpaper.h"
#include "screenplaywidget.h" #include "ScreenPlay/screenplaywidget.h"
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#include <qt_windows.h> #include <qt_windows.h>

View File

@ -43,8 +43,8 @@
#include <QUrl> #include <QUrl>
#include <QVector> #include <QVector>
#include "globalvariables.h" #include "ScreenPlay/globalvariables.h"
#include "profile.h" #include "ScreenPlay/profile.h"
#include <memory> #include <memory>

View File

@ -43,7 +43,7 @@
#include <QJsonObject> #include <QJsonObject>
#include <QVector> #include <QVector>
#include "util.h" #include "ScreenPlay/util.h"
namespace ScreenPlay { namespace ScreenPlay {

View File

@ -41,11 +41,11 @@
#include <memory> #include <memory>
#include "globalvariables.h" #include "ScreenPlay/globalvariables.h"
#include "projectsettingslistmodel.h" #include "ScreenPlay/projectsettingslistmodel.h"
#include "sdkconnection.h" #include "ScreenPlay/sdkconnection.h"
#include "settings.h" #include "ScreenPlay/settings.h"
#include "util.h" #include "ScreenPlay/util.h"
namespace ScreenPlay { namespace ScreenPlay {

View File

@ -43,9 +43,9 @@
#include <QProcess> #include <QProcess>
#include "ScreenPlayUtil/util.h" #include "ScreenPlayUtil/util.h"
#include "globalvariables.h" #include "ScreenPlay/globalvariables.h"
#include "projectsettingslistmodel.h" #include "ScreenPlay/projectsettingslistmodel.h"
#include "sdkconnection.h" #include "ScreenPlay/sdkconnection.h"
#include <memory> #include <memory>
#include <utility> #include <utility>

View File

@ -47,8 +47,8 @@
#include <QWebSocketServer> #include <QWebSocketServer>
#include "ScreenPlayUtil/util.h" #include "ScreenPlayUtil/util.h"
#include "globalvariables.h" #include "ScreenPlay/globalvariables.h"
#include "util.h" #include "ScreenPlay/util.h"
#include <memory> #include <memory>

View File

@ -61,8 +61,8 @@
#include <QtConcurrent/QtConcurrent> #include <QtConcurrent/QtConcurrent>
#include <QtGlobal> #include <QtGlobal>
#include "globalvariables.h" #include "ScreenPlay/globalvariables.h"
#include "util.h" #include "ScreenPlay/util.h"
#include <memory> #include <memory>
#include <optional> #include <optional>

View File

@ -54,7 +54,7 @@
#include <qqml.h> #include <qqml.h>
#include "ScreenPlayUtil/util.h" #include "ScreenPlayUtil/util.h"
#include "globalvariables.h" #include "ScreenPlay/globalvariables.h"
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>

View File

@ -54,9 +54,9 @@
#include <QUrl> #include <QUrl>
#include <QtMath> #include <QtMath>
#include "createimportvideo.h" #include "ScreenPlay/createimportvideo.h"
#include "globalvariables.h" #include "ScreenPlay/globalvariables.h"
#include "util.h" #include "ScreenPlay/util.h"
#include <memory> #include <memory>
#include <optional> #include <optional>

View File

@ -32,7 +32,7 @@
** **
****************************************************************************/ ****************************************************************************/
#include "app.h" #include "ScreenPlay/app.h"
#include <QApplication> #include <QApplication>
#include <QCommandLineParser> #include <QCommandLineParser>
#include <QDebug> #include <QDebug>

View File

@ -1,4 +1,4 @@
#include "app.h" #include "ScreenPlay/app.h"
#include "steam/steam_qt_enums_generated.h" #include "steam/steam_qt_enums_generated.h"
#include <QProcessEnvironment> #include <QProcessEnvironment>

View File

@ -1,4 +1,4 @@
#include "create.h" #include "ScreenPlay/create.h"
namespace ScreenPlay { namespace ScreenPlay {

View File

@ -1,4 +1,4 @@
#include "createimportvideo.h" #include "ScreenPlay/createimportvideo.h"
#include "ScreenPlayUtil/util.h" #include "ScreenPlayUtil/util.h"
namespace ScreenPlay { namespace ScreenPlay {

View File

@ -1,4 +1,4 @@
#include "globalvariables.h" #include "ScreenPlay/globalvariables.h"
namespace ScreenPlay { namespace ScreenPlay {

View File

@ -1,4 +1,4 @@
#include "installedlistfilter.h" #include "ScreenPlay/installedlistfilter.h"
namespace ScreenPlay { namespace ScreenPlay {

View File

@ -1,4 +1,4 @@
#include "installedlistmodel.h" #include "ScreenPlay/installedlistmodel.h"
#include <QDebug> #include <QDebug>
namespace ScreenPlay { namespace ScreenPlay {

View File

@ -1,4 +1,4 @@
#include "monitorlistmodel.h" #include "ScreenPlay/monitorlistmodel.h"
namespace ScreenPlay { namespace ScreenPlay {

View File

@ -1,4 +1,4 @@
#include "profilelistmodel.h" #include "ScreenPlay/profilelistmodel.h"
#include <QDirIterator> #include <QDirIterator>
#include <QFileInfoList> #include <QFileInfoList>

View File

@ -1,4 +1,4 @@
#include "projectsettingslistmodel.h" #include "ScreenPlay/projectsettingslistmodel.h"
namespace ScreenPlay { namespace ScreenPlay {

View File

@ -1,4 +1,4 @@
#include "screenplaymanager.h" #include "ScreenPlay/screenplaymanager.h"
#include <QScopeGuard> #include <QScopeGuard>
namespace ScreenPlay { namespace ScreenPlay {

View File

@ -1,4 +1,4 @@
#include "screenplaywallpaper.h" #include "ScreenPlay/screenplaywallpaper.h"
namespace ScreenPlay { namespace ScreenPlay {

View File

@ -1,4 +1,4 @@
#include "screenplaywidget.h" #include "ScreenPlay/screenplaywidget.h"
namespace ScreenPlay { namespace ScreenPlay {

View File

@ -1,4 +1,4 @@
#include "sdkconnection.h" #include "ScreenPlay/sdkconnection.h"
namespace ScreenPlay { namespace ScreenPlay {

View File

@ -1,4 +1,4 @@
#include "settings.h" #include "ScreenPlay/settings.h"
#include "ScreenPlayUtil/util.h" #include "ScreenPlayUtil/util.h"
#include <QFileInfo> #include <QFileInfo>

View File

@ -1,4 +1,4 @@
#include "util.h" #include "ScreenPlay/util.h"
#include <sentry.h> #include <sentry.h>

View File

@ -1,4 +1,4 @@
#include "wizards.h" #include "ScreenPlay/wizards.h"
#include "ScreenPlayUtil/util.h" #include "ScreenPlayUtil/util.h"

View File

@ -32,8 +32,8 @@
** **
****************************************************************************/ ****************************************************************************/
#include "app.h" #include "ScreenPlay/app.h"
#include "create.h" #include "ScreenPlay/create.h"
#include <QApplication> #include <QApplication>
#include <QCommandLineParser> #include <QCommandLineParser>
#include <QCoreApplication> #include <QCoreApplication>
@ -45,6 +45,7 @@
Q_IMPORT_QML_PLUGIN(ScreenPlayQmlPlugin) Q_IMPORT_QML_PLUGIN(ScreenPlayQmlPlugin)
Q_IMPORT_QML_PLUGIN(ScreenPlayUtilPlugin) Q_IMPORT_QML_PLUGIN(ScreenPlayUtilPlugin)
Q_IMPORT_QML_PLUGIN(ScreenPlayWorkshopPlugin)
class ScreenPlayTest : public QObject { class ScreenPlayTest : public QObject {
Q_OBJECT Q_OBJECT
@ -52,8 +53,7 @@ class ScreenPlayTest : public QObject {
private slots: private slots:
void initTestCase() void initTestCase()
{ {
Q_INIT_RESOURCE(ScreenPlayQML); Q_INIT_RESOURCE(Resources);
Q_INIT_RESOURCE(ScreenPlayAssets);
app.init(); app.init();
m_window = qobject_cast<QQuickWindow*>(app.mainWindowEngine()->rootObjects().first()); m_window = qobject_cast<QQuickWindow*>(app.mainWindowEngine()->rootObjects().first());

View File

@ -23,20 +23,18 @@ set(SHADER
shaders/lightning.frag shaders/lightning.frag
shaders/wobble.frag shaders/wobble.frag
shaders/water.frag shaders/water.frag
shaders/water.vert shaders/water.vert)
)
set(RESOURCES set(RESOURCES
assets/mask_01.png assets/mask_01.png
assets/Shadertoy_Bayer.png assets/Shadertoy_Bayer.png
assets/Shadertoy_Gray_Noise_Medium.png assets/Shadertoy_Gray_Noise_Medium.png
assets/Shadertoy_Lichen.jpg assets/Shadertoy_Lichen.jpg
assets/test_image_andras-vas-Bd7gNnWJBkU-unsplash.jpg assets/test_image_andras-vas-Bd7gNnWJBkU-unsplash.jpg)
)
qt_add_library(${PROJECT_NAME} STATIC) qt_add_library(${PROJECT_NAME} STATIC)
target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Core Qt6::Quick) target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Core Qt6::Quick)
target_include_directories(${PROJECT_NAME} PUBLIC src/ ) target_include_directories(${PROJECT_NAME} PUBLIC src/)
qt_add_qml_module( qt_add_qml_module(
${PROJECT_NAME} ${PROJECT_NAME}
@ -67,6 +65,6 @@ qt6_add_shaders(
if(${SCREENPLAY_TESTS}) if(${SCREENPLAY_TESTS})
qt_add_executable(tst_ScreenPlayShader src/TestMain.cpp) qt_add_executable(tst_ScreenPlayShader src/TestMain.cpp)
target_link_libraries(tst_ScreenPlayShader PRIVATE Qt::Quick ${PROJECT_NAME}plugin ) target_link_libraries(tst_ScreenPlayShader PRIVATE Qt::Quick ${PROJECT_NAME}plugin)
target_compile_definitions(tst_ScreenPlayShader PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>) target_compile_definitions(tst_ScreenPlayShader PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
endif() endif()

View File

@ -41,7 +41,7 @@ Common.Dialog {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: 150 Layout.preferredWidth: 150
Layout.preferredHeight: 150 Layout.preferredHeight: 150
source: "qrc:/ScreenPlayWorkshop/assets/icons/exclamation-triangle-solid.svg" source: "qrc:/assets/icons/exclamation-triangle-solid.svg"
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
layer { layer {

View File

@ -86,7 +86,6 @@ elseif(UNIX)
set(STEAM_BIN ${STEAM_LIB}) set(STEAM_BIN ${STEAM_LIB})
endif() endif()
qt_add_library(${PROJECT_NAME} STATIC ${RESOURCES}) qt_add_library(${PROJECT_NAME} STATIC ${RESOURCES})
# Needed by the automatic generated target missing includes # Needed by the automatic generated target missing includes
# https://github.com/qt/qtdeclarative/blob/7a7064e14f094e843e1ee832cc927e86f887621a/src/qml/Qt6QmlMacros.cmake#L2042 # https://github.com/qt/qtdeclarative/blob/7a7064e14f094e843e1ee832cc927e86f887621a/src/qml/Qt6QmlMacros.cmake#L2042
@ -133,13 +132,13 @@ if(${SCREENPLAY_STEAM})
if(${SCREENPLAY_TESTS}) if(${SCREENPLAY_TESTS})
qt_add_executable(tst_ScreenPlayWorkshop src/TestMain.cpp) qt_add_executable(tst_ScreenPlayWorkshop src/TestMain.cpp)
target_link_libraries(tst_ScreenPlayWorkshop PRIVATE target_link_libraries(
Qt6::Quick tst_ScreenPlayWorkshop
${PROJECT_NAME}plugin PRIVATE Qt6::Quick
ScreenPlayUtilplugin ${PROJECT_NAME}plugin
SteamSDK ScreenPlayUtilplugin
SteamSDKQtEnums) SteamSDK
SteamSDKQtEnums)
target_compile_definitions(tst_ScreenPlayWorkshop PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>) target_compile_definitions(tst_ScreenPlayWorkshop PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
endif() endif()
endif() endif()