From 01489b9dfceaa2c4d7e489834e0bec2198571090 Mon Sep 17 00:00:00 2001
From: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com>
Date: Wed, 29 Mar 2023 16:02:29 -0400
Subject: [PATCH] tests: qml: fix some ViewCoordinator related warnings

Gitlab: #899
Change-Id: I5bc73e07f15e73ee2f84e8e5c02689c81e670272
---
 src/app/commoncomponents/DualPaneView.qml        | 4 ++--
 tests/qml/resources.qrc                          | 4 +---
 tests/qml/src/tst_NewSwarmPage.qml               | 6 ++++++
 tests/qml/src/tst_WizardView.qml                 | 6 ++++++
 tests/qml/{src => to_fix}/tst_ChatViewFooter.qml | 0
 5 files changed, 15 insertions(+), 5 deletions(-)
 rename tests/qml/{src => to_fix}/tst_ChatViewFooter.qml (100%)

diff --git a/src/app/commoncomponents/DualPaneView.qml b/src/app/commoncomponents/DualPaneView.qml
index a4dc8ce81..a2405686a 100644
--- a/src/app/commoncomponents/DualPaneView.qml
+++ b/src/app/commoncomponents/DualPaneView.qml
@@ -38,8 +38,8 @@ BaseView {
     property bool isSinglePane
 
     onPresented: {
-        leftPaneItem.parent = leftPane
-        rightPaneItem.parent = rightPane
+        if (leftPaneItem) leftPaneItem.parent = leftPane
+        if (rightPaneItem) rightPaneItem.parent = rightPane
 
         splitView.restoreSplitViewState()
 
diff --git a/tests/qml/resources.qrc b/tests/qml/resources.qrc
index 9962a13a6..97f685ad3 100644
--- a/tests/qml/resources.qrc
+++ b/tests/qml/resources.qrc
@@ -2,11 +2,9 @@
     <qresource prefix="/">
         <file>src/tst_LocalAccount.qml</file>
         <file>src/tst_WizardView.qml</file>
-        <!--<file>src/tst_PresenceIndicator.qml</file>
-        <file>src/tst_ChatViewFooter.qml</file>
+        <file>src/tst_NewSwarmPage.qml</file>
         <file>src/resources/gif_test.gif</file>
         <file>src/resources/gz_test.gz</file>
         <file>src/resources/png_test.png</file>
-        <file>src/tst_FilesToSendContainer.qml</file>-->
     </qresource>
 </RCC>
diff --git a/tests/qml/src/tst_NewSwarmPage.qml b/tests/qml/src/tst_NewSwarmPage.qml
index bf0d9e897..bb8af020e 100644
--- a/tests/qml/src/tst_NewSwarmPage.qml
+++ b/tests/qml/src/tst_NewSwarmPage.qml
@@ -24,6 +24,7 @@ import QtTest
 import net.jami.Models 1.1
 import net.jami.Constants 1.1
 
+import "../../../src/app/"
 import "../../../src/app/mainview/components"
 
 ColumnLayout {
@@ -37,6 +38,11 @@ ColumnLayout {
     NewSwarmPage {
         id: uut
 
+        property ViewManager viewManager: ViewManager {}
+        property ViewCoordinator viewCoordinator: ViewCoordinator {
+            viewManager: uut.viewManager
+        }
+
         Layout.alignment: Qt.AlignHCenter
         Layout.preferredWidth: root.width
         Layout.maximumWidth: JamiTheme.chatViewMaximumWidth
diff --git a/tests/qml/src/tst_WizardView.qml b/tests/qml/src/tst_WizardView.qml
index fcdbb528f..367b407d5 100644
--- a/tests/qml/src/tst_WizardView.qml
+++ b/tests/qml/src/tst_WizardView.qml
@@ -24,12 +24,18 @@ import net.jami.Models 1.1
 import net.jami.Constants 1.1
 import net.jami.Enums 1.1
 
+import "../../../src/app/"
 import "../../../src/app/wizardview"
 import "../../../src/app/commoncomponents"
 
 WizardView {
     id: uut
 
+    property ViewManager viewManager: ViewManager {}
+    property ViewCoordinator viewCoordinator: ViewCoordinator {
+        viewManager: uut.viewManager
+    }
+
     function clearSignalSpy() {
         spyAccountIsReady.clear()
         spyAccountIsRemoved.clear()
diff --git a/tests/qml/src/tst_ChatViewFooter.qml b/tests/qml/to_fix/tst_ChatViewFooter.qml
similarity index 100%
rename from tests/qml/src/tst_ChatViewFooter.qml
rename to tests/qml/to_fix/tst_ChatViewFooter.qml
-- 
GitLab