1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-08-17 05:05:44 +02:00

chatview: fix footer on banned contacts

isBlocked doesn't exist, it's isBanned.
Also link spfm and webengine to tests (in order to fix
tst_ChatViewFooter.qml)

Change-Id: Ic4ac0565ba5975213728b16e3e3d5718aa9851b6
This commit is contained in:
Sébastien Blin 2022-12-19 13:51:45 -05:00
parent 5e4e2e8c82
commit 72e8cf42fa
4 changed files with 95 additions and 121 deletions

View file

@ -252,7 +252,7 @@ Rectangle {
visible: { visible: {
if (CurrentAccount.type === Profile.Type.SIP) if (CurrentAccount.type === Profile.Type.SIP)
return true return true
if (CurrentConversation.isBlocked) if (CurrentConversation.isBanned)
return false return false
else if (CurrentConversation.needsSyncing) else if (CurrentConversation.needsSyncing)
return false return false

View file

@ -35,6 +35,7 @@ add_executable(qml_tests
${QML_RESOURCES} ${QML_RESOURCES}
${QML_RESOURCES_QML} ${QML_RESOURCES_QML}
${TEST_QML_RESOURCES} ${TEST_QML_RESOURCES}
${SFPM_OBJECTS}
$<TARGET_OBJECTS:test_common_obj>) $<TARGET_OBJECTS:test_common_obj>)
target_link_libraries(qml_tests target_link_libraries(qml_tests

View file

@ -17,20 +17,21 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
#include "mainapplication.h"
#include "qmlregister.h"
#include "appsettingsmanager.h" #include "appsettingsmanager.h"
#include "connectivitymonitor.h" #include "connectivitymonitor.h"
#include "systemtray.h" #include "mainapplication.h"
#include "previewengine.h" #include "previewengine.h"
#include "qmlregister.h"
#include "systemtray.h"
#include "videoprovider.h"
#include <atomic> #include <atomic>
#include <QFontDatabase>
#include <QQmlContext>
#include <QQmlEngine>
#include <QScopedPointer> #include <QScopedPointer>
#include <QtQuickTest/quicktest.h> #include <QtQuickTest/quicktest.h>
#include <QQmlEngine>
#include <QQmlContext>
#include <QFontDatabase>
#ifdef WITH_WEBENGINE #ifdef WITH_WEBENGINE
#include <QtWebEngineCore> #include <QtWebEngineCore>
#include <QtWebEngineQuick> #include <QtWebEngineQuick>
@ -43,17 +44,13 @@
#include <gnutls/gnutls.h> #include <gnutls/gnutls.h>
#endif #endif
class Setup : public QObject class Setup : public QObject {
{
Q_OBJECT Q_OBJECT
public: public:
Setup(bool muteDring = false) Setup(bool muteDring = false) : muteDring_(muteDring) {}
: muteDring_(muteDring)
{}
void init() void init() {
{
connectivityMonitor_.reset(new ConnectivityMonitor(this)); connectivityMonitor_.reset(new ConnectivityMonitor(this));
settingsManager_.reset(new AppSettingsManager(this)); settingsManager_.reset(new AppSettingsManager(this));
systemTray_.reset(new SystemTray(settingsManager_.get(), this)); systemTray_.reset(new SystemTray(settingsManager_.get(), this));
@ -64,24 +61,20 @@ public:
gnutls_global_init(); gnutls_global_init();
#endif #endif
lrcInstance_.reset( lrcInstance_.reset(new LRCInstance(nullptr, nullptr, "",
new LRCInstance(nullptr, nullptr, "", connectivityMonitor_.get(), muteDring_)); connectivityMonitor_.get(), muteDring_));
lrcInstance_->subscribeToDebugReceived(); lrcInstance_->subscribeToDebugReceived();
auto downloadPath = settingsManager_->getValue(Settings::Key::DownloadPath); auto downloadPath = settingsManager_->getValue(Settings::Key::DownloadPath);
lrcInstance_->accountModel().downloadDirectory = downloadPath.toString() + "/"; lrcInstance_->accountModel().downloadDirectory =
downloadPath.toString() + "/";
} }
void qmlEngineRegistration(QQmlEngine* engine) void qmlEngineRegistration(QQmlEngine *engine) {
{
// Expose custom types to the QML engine. // Expose custom types to the QML engine.
Utils::registerTypes(engine, Utils::registerTypes(engine, systemTray_.get(), lrcInstance_.get(),
systemTray_.get(), settingsManager_.get(), previewEngine_.get(),
lrcInstance_.get(), &screenInfo_, this);
settingsManager_.get(),
previewEngine_.get(),
&screenInfo_,
this);
} }
public Q_SLOTS: public Q_SLOTS:
@ -89,10 +82,7 @@ public Q_SLOTS:
/*! /*!
* Called once before qmlEngineAvailable. * Called once before qmlEngineAvailable.
*/ */
void applicationAvailable() void applicationAvailable() { init(); }
{
init();
}
/*! /*!
* Called when the QML engine is available. Any import paths, plugin paths, * Called when the QML engine is available. Any import paths, plugin paths,
@ -104,8 +94,15 @@ public Q_SLOTS:
* This function can be used to register QML types and add import paths, * This function can be used to register QML types and add import paths,
* amongst other things. * amongst other things.
*/ */
void qmlEngineAvailable(QQmlEngine* engine) void qmlEngineAvailable(QQmlEngine *engine) {
{ 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
qmlEngineRegistration(engine); qmlEngineRegistration(engine);
} }
@ -127,9 +124,7 @@ private:
bool muteDring_{false}; bool muteDring_{false};
}; };
int int main(int argc, char **argv) {
main(int argc, char** argv)
{
QDir tempDir(QStandardPaths::writableLocation(QStandardPaths::TempLocation)); QDir tempDir(QStandardPaths::writableLocation(QStandardPaths::TempLocation));
auto jamiDataDir = tempDir.absolutePath() + "\\jami_test\\jami"; auto jamiDataDir = tempDir.absolutePath() + "\\jami_test\\jami";

View file

@ -22,8 +22,9 @@ import QtQuick.Layouts
import QtTest import QtTest
import net.jami.Models 1.1 import net.jami.Adapters 1.1
import net.jami.Constants 1.1 import net.jami.Constants 1.1
import net.jami.Models 1.1
import "../../../src/app/mainview/components" import "../../../src/app/mainview/components"
@ -62,29 +63,6 @@ ColumnLayout {
messageBarTextArea.clearText() messageBarTextArea.clearText()
compare(sendMessageButton.visible, false) compare(sendMessageButton.visible, false)
// File added into filesToSendContainer will cause sendMessageButton to show
filesToSendContainer.filesToSendListModel.addToPending(
":/src/app/resources/png_test.png")
compare(filesToSendContainer.filesToSendCount, 1)
compare(sendMessageButton.visible, true)
// Files cleared from filesToSendContainer will cause sendMessageButton to hide
filesToSendContainer.filesToSendListModel.flush()
compare(filesToSendContainer.filesToSendCount, 0)
compare(sendMessageButton.visible, false)
// When the text and files both exist,
// clear one of them will still make sendMessageButton to show
messageBarTextArea.insertText("test")
filesToSendContainer.filesToSendListModel.addToPending(
":/src/app/resources/png_test.png")
messageBarTextArea.clearText()
compare(sendMessageButton.visible, true)
messageBarTextArea.insertText("test")
filesToSendContainer.filesToSendListModel.flush()
compare(sendMessageButton.visible, true)
// Both are cleared // Both are cleared
messageBarTextArea.clearText() messageBarTextArea.clearText()
compare(sendMessageButton.visible, false) compare(sendMessageButton.visible, false)