mirror of
https://github.com/savoirfairelinux/jami-client-qt.git
synced 2025-12-19 01:52:30 +08:00
misc: fix automated tests
Broken by https://review.jami.net/c/jami-client-qt/+/26560. This moves some logic that has been previously duplicated between the app and tests into a common routine. Change-Id: I40f1af38893cfcef751578d3e4db7d7ba040505b
This commit is contained in:
@@ -29,13 +29,12 @@ else()
|
|||||||
project(jami)
|
project(jami)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
include(${PROJECT_SOURCE_DIR}/extras/build/cmake/extra_tools.cmake)
|
||||||
|
|
||||||
option(WITH_DAEMON_SUBMODULE "Build with daemon submodule" ON)
|
option(WITH_DAEMON_SUBMODULE "Build with daemon submodule" ON)
|
||||||
option(JAMICORE_AS_SUBDIR "Build Jami-core as a subdir dependency" OFF)
|
option(JAMICORE_AS_SUBDIR "Build Jami-core as a subdir dependency" OFF)
|
||||||
option(ENABLE_TESTS "Build with tests" OFF)
|
option(ENABLE_TESTS "Build with tests" OFF)
|
||||||
option(WITH_WEBENGINE "Build with WebEngine" ON)
|
option(WITH_WEBENGINE "Build with WebEngine" ON)
|
||||||
if(WITH_WEBENGINE)
|
|
||||||
add_definitions(-DWITH_WEBENGINE)
|
|
||||||
endif()
|
|
||||||
option(ENABLE_LIBWRAP "Enable libwrap (single process mode)" ON)
|
option(ENABLE_LIBWRAP "Enable libwrap (single process mode)" ON)
|
||||||
if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||||
OR ENABLE_LIBWRAP
|
OR ENABLE_LIBWRAP
|
||||||
@@ -51,6 +50,10 @@ if(ENABLE_ASAN AND NOT MSVC)
|
|||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# These values are exposed to QML and are better off being defined as values.
|
||||||
|
define_macro_with_value(WITH_WEBENGINE)
|
||||||
|
define_macro_with_value(APPSTORE)
|
||||||
|
|
||||||
# jami-core
|
# jami-core
|
||||||
if(NOT WITH_DAEMON_SUBMODULE)
|
if(NOT WITH_DAEMON_SUBMODULE)
|
||||||
set(DAEMON_DIR ${PROJECT_SOURCE_DIR}/../daemon)
|
set(DAEMON_DIR ${PROJECT_SOURCE_DIR}/../daemon)
|
||||||
@@ -837,7 +840,6 @@ else()
|
|||||||
MACOSX_BUNDLE_COPYRIGHT "${PROJ_COPYRIGHT}")
|
MACOSX_BUNDLE_COPYRIGHT "${PROJ_COPYRIGHT}")
|
||||||
if(APPSTORE)
|
if(APPSTORE)
|
||||||
message(STATUS "app store version")
|
message(STATUS "app store version")
|
||||||
add_definitions(-DAPPSTORE)
|
|
||||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||||
XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS "${CMAKE_CURRENT_SOURCE_DIR}/resources/entitlements/appstore/Jami.entitlements")
|
XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS "${CMAKE_CURRENT_SOURCE_DIR}/resources/entitlements/appstore/Jami.entitlements")
|
||||||
else()
|
else()
|
||||||
|
|||||||
38
extras/build/cmake/extra_tools.cmake
Normal file
38
extras/build/cmake/extra_tools.cmake
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
# Copyright (C) 2024 Savoir-faire Linux Inc.
|
||||||
|
#
|
||||||
|
# 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, write to the Free Software
|
||||||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
|
# Function to define a macro with a specific value or default to 0 if not already set.
|
||||||
|
# This is useful to if within the code we don't want to use #ifdef but rather use the
|
||||||
|
# value of the macro.
|
||||||
|
function(define_macro_with_value MACRO_NAME)
|
||||||
|
if(DEFINED ${MACRO_NAME})
|
||||||
|
# Convert ON/OFF to 1/0
|
||||||
|
if(${${MACRO_NAME}} STREQUAL "ON")
|
||||||
|
set(MACRO_VALUE "1")
|
||||||
|
elseif(${${MACRO_NAME}} STREQUAL "OFF")
|
||||||
|
set(MACRO_VALUE "0")
|
||||||
|
# If the macro is defined and its value is neither "ON" nor "OFF",
|
||||||
|
# set MACRO_VALUE to the macro's current value
|
||||||
|
else()
|
||||||
|
set(MACRO_VALUE "${${MACRO_NAME}}")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
set(MACRO_VALUE "0")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Add the macro definition to the compiler command line
|
||||||
|
add_definitions("-D${MACRO_NAME}=${MACRO_VALUE}")
|
||||||
|
endfunction()
|
||||||
@@ -25,9 +25,7 @@
|
|||||||
#include "appsettingsmanager.h"
|
#include "appsettingsmanager.h"
|
||||||
#include "connectivitymonitor.h"
|
#include "connectivitymonitor.h"
|
||||||
#include "systemtray.h"
|
#include "systemtray.h"
|
||||||
#include "videoprovider.h"
|
|
||||||
#include "previewengine.h"
|
#include "previewengine.h"
|
||||||
#include "conversationlistmodel.h"
|
|
||||||
|
|
||||||
#include <QWKQuick/qwkquickglobal.h>
|
#include <QWKQuick/qwkquickglobal.h>
|
||||||
|
|
||||||
@@ -257,18 +255,6 @@ MainApplication::init()
|
|||||||
// The presence of start URI should override the startMinimized setting for this instance.
|
// The presence of start URI should override the startMinimized setting for this instance.
|
||||||
set_startMinimized(startMinimizedSetting && runOptions_[Option::StartUri].isNull());
|
set_startMinimized(startMinimizedSetting && runOptions_[Option::StartUri].isNull());
|
||||||
|
|
||||||
#ifdef WITH_WEBENGINE
|
|
||||||
engine_.get()->rootContext()->setContextProperty("WITH_WEBENGINE", QVariant(true));
|
|
||||||
#else
|
|
||||||
engine_.get()->rootContext()->setContextProperty("WITH_WEBENGINE", QVariant(false));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef APPSTORE
|
|
||||||
engine_.get()->rootContext()->setContextProperty("APPSTORE", QVariant(true));
|
|
||||||
#else
|
|
||||||
engine_.get()->rootContext()->setContextProperty("APPSTORE", QVariant(false));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
initQmlLayer();
|
initQmlLayer();
|
||||||
|
|
||||||
settingsManager_->setValue(Settings::Key::StartMinimized,
|
settingsManager_->setValue(Settings::Key::StartMinimized,
|
||||||
@@ -413,13 +399,9 @@ MainApplication::initQmlLayer()
|
|||||||
&screenInfo_,
|
&screenInfo_,
|
||||||
this);
|
this);
|
||||||
|
|
||||||
auto videoProvider = new VideoProvider(lrcInstance_->avModel(), this);
|
|
||||||
engine_->rootContext()->setContextProperty("videoProvider", videoProvider);
|
|
||||||
|
|
||||||
// Find modules (runtime) under the root source dir.
|
|
||||||
engine_->addImportPath("qrc:/");
|
|
||||||
|
|
||||||
engine_->load(QUrl(QStringLiteral("qrc:/MainApplicationWindow.qml")));
|
engine_->load(QUrl(QStringLiteral("qrc:/MainApplicationWindow.qml")));
|
||||||
|
|
||||||
|
// Report the render interface used.
|
||||||
qCWarning(app_) << "Main window loaded using" << getRenderInterfaceString();
|
qCWarning(app_) << "Main window loaded using" << getRenderInterfaceString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,8 +57,8 @@ private:
|
|||||||
class MainApplication : public QApplication
|
class MainApplication : public QApplication
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_DISABLE_COPY(MainApplication)
|
|
||||||
QML_RO_PROPERTY(bool, startMinimized)
|
QML_RO_PROPERTY(bool, startMinimized)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit MainApplication(int& argc, char** argv);
|
explicit MainApplication(int& argc, char** argv);
|
||||||
~MainApplication();
|
~MainApplication();
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
#include "callparticipantsmodel.h"
|
#include "callparticipantsmodel.h"
|
||||||
#include "pluginlistmodel.h"
|
#include "pluginlistmodel.h"
|
||||||
#include "pluginstorelistmodel.h"
|
#include "pluginstorelistmodel.h"
|
||||||
|
#include "videoprovider.h"
|
||||||
#include "qrimageprovider.h"
|
#include "qrimageprovider.h"
|
||||||
#include "avatarimageprovider.h"
|
#include "avatarimageprovider.h"
|
||||||
#include "avatarregistry.h"
|
#include "avatarregistry.h"
|
||||||
@@ -74,6 +74,7 @@
|
|||||||
|
|
||||||
#include <QMetaType>
|
#include <QMetaType>
|
||||||
#include <QQmlEngine>
|
#include <QQmlEngine>
|
||||||
|
#include <QQmlContext>
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
// TODO: remove this
|
// TODO: remove this
|
||||||
@@ -272,6 +273,15 @@ registerTypes(QQmlEngine* engine,
|
|||||||
|
|
||||||
engine->addImageProvider(QLatin1String("qrImage"), new QrImageProvider(lrcInstance));
|
engine->addImageProvider(QLatin1String("qrImage"), new QrImageProvider(lrcInstance));
|
||||||
engine->addImageProvider(QLatin1String("avatarimage"), new AvatarImageProvider(lrcInstance));
|
engine->addImageProvider(QLatin1String("avatarimage"), new AvatarImageProvider(lrcInstance));
|
||||||
|
|
||||||
|
// Find modules (runtime) under the root source dir.
|
||||||
|
engine->addImportPath("qrc:/");
|
||||||
|
|
||||||
|
auto videoProvider = new VideoProvider(lrcInstance->avModel(), app);
|
||||||
|
engine->rootContext()->setContextProperty("videoProvider", videoProvider);
|
||||||
|
|
||||||
|
engine->rootContext()->setContextProperty("WITH_WEBENGINE", WITH_WEBENGINE);
|
||||||
|
engine->rootContext()->setContextProperty("APPSTORE", APPSTORE);
|
||||||
}
|
}
|
||||||
// clang-format on
|
// clang-format on
|
||||||
} // namespace Utils
|
} // namespace Utils
|
||||||
|
|||||||
@@ -22,6 +22,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "api/conversationmodel.h"
|
||||||
|
|
||||||
#include <QCryptographicHash>
|
#include <QCryptographicHash>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
@@ -47,10 +49,6 @@
|
|||||||
#define LPCWSTR char*
|
#define LPCWSTR char*
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "api/account.h"
|
|
||||||
#include "api/contactmodel.h"
|
|
||||||
#include "api/conversationmodel.h"
|
|
||||||
|
|
||||||
class LRCInstance;
|
class LRCInstance;
|
||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
#include "previewengine.h"
|
#include "previewengine.h"
|
||||||
#include "qmlregister.h"
|
#include "qmlregister.h"
|
||||||
#include "systemtray.h"
|
#include "systemtray.h"
|
||||||
#include "videoprovider.h"
|
|
||||||
#include "api/profile.h"
|
#include "api/profile.h"
|
||||||
#include "api/account.h"
|
#include "api/account.h"
|
||||||
#include "api/conversationmodel.h"
|
#include "api/conversationmodel.h"
|
||||||
@@ -139,14 +139,6 @@ public Q_SLOTS:
|
|||||||
previewEngine_.get(),
|
previewEngine_.get(),
|
||||||
&screenInfo_,
|
&screenInfo_,
|
||||||
this);
|
this);
|
||||||
|
|
||||||
auto videoProvider = new VideoProvider(lrcInstance_->avModel(), this);
|
|
||||||
engine->rootContext()->setContextProperty("videoProvider", videoProvider);
|
|
||||||
#ifdef WITH_WEBENGINE
|
|
||||||
engine->rootContext()->setContextProperty("WITH_WEBENGINE", QVariant(true));
|
|
||||||
#else
|
|
||||||
engine->rootContext()->setContextProperty("WITH_WEBENGINE", QVariant(false));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user