diff --git a/src/app/conversationlistmodelbase.h b/src/app/conversationlistmodelbase.h index 23dc90071f497a605c9a7e3ba2227240448b5bb0..b2e488d1d2432c75ed9ea9a99f9cbb86e661f6cd 100644 --- a/src/app/conversationlistmodelbase.h +++ b/src/app/conversationlistmodelbase.h @@ -80,6 +80,6 @@ protected: using Role = ConversationList::Role; // Convenience pointer to be pulled from lrcinstance - ConversationModel* model_; + ConversationModel* model_ {nullptr}; QString accountId_; }; diff --git a/src/app/mainview/components/RecordBox.qml b/src/app/mainview/components/RecordBox.qml index c18db88510f91c11fca38a15f94f3f07419bdba6..1e1aca66802f0798977304fd903dea7773c2e509 100644 --- a/src/app/mainview/components/RecordBox.qml +++ b/src/app/mainview/components/RecordBox.qml @@ -149,6 +149,7 @@ Popup { PushButton { id: cancelBtn + objectName: "cancelBtn" z: 1 normalColor: "transparent" @@ -164,6 +165,7 @@ Popup { anchors.top: box.top anchors.margins: 8 + focusPolicy: Qt.TabFocus onClicked: { closeRecorder(); updateState(RecordBox.States.INIT); @@ -253,7 +255,7 @@ Popup { PushButton { id: recordButton - + objectName: "recordButton" Layout.alignment: Qt.AlignCenter preferredSize: btnSize @@ -264,6 +266,7 @@ Popup { source: JamiResources.fiber_manual_record_24dp_svg imageColor: JamiTheme.recordIconColor + focusPolicy: Qt.TabFocus onClicked: { updateState(RecordBox.States.RECORDING); if (!root.isPhoto) @@ -273,7 +276,7 @@ Popup { PushButton { id: screenshotBtn - + objectName: "screenshotBtn" Layout.alignment: Qt.AlignCenter preferredSize: btnSize @@ -286,6 +289,7 @@ Popup { source: JamiResources.fiber_manual_record_24dp_svg imageColor: UtilsAdapter.luma(JamiTheme.backgroundColor) ? "white" : JamiTheme.redColor + focusPolicy: Qt.TabFocus onClicked: { root.photo = videoProvider.captureVideoFrame(VideoDevices.getDefaultDevice()); updateState(RecordBox.States.REC_SUCCESS); @@ -294,7 +298,7 @@ Popup { PushButton { id: btnStop - + objectName: "btnStop" Layout.alignment: Qt.AlignCenter preferredSize: btnSize @@ -307,6 +311,7 @@ Popup { border.width: 1 border.color: imageColor + focusPolicy: Qt.TabFocus onClicked: { if (!root.isPhoto) stopRecording(); @@ -316,7 +321,7 @@ Popup { PushButton { id: btnRestart - + objectName: "btnRestart" Layout.alignment: Qt.AlignCenter preferredSize: btnSize @@ -329,6 +334,7 @@ Popup { border.width: 1 border.color: imageColor + focusPolicy: Qt.TabFocus onClicked: { if (!root.isPhoto) stopRecording(); @@ -338,7 +344,7 @@ Popup { PushButton { id: btnSend - + objectName: "btnSend" Layout.alignment: Qt.AlignCenter preferredSize: btnSize @@ -350,6 +356,7 @@ Popup { border.width: 1 border.color: imageColor + focusPolicy: Qt.TabFocus onClicked: { if (!root.isPhoto) { stopRecording(); diff --git a/tests/qml/src/tst_RecordBox.qml b/tests/qml/src/tst_RecordBox.qml new file mode 100644 index 0000000000000000000000000000000000000000..b5a0c1fb31463f1f64b1e3d7905ba34a58a5bc4d --- /dev/null +++ b/tests/qml/src/tst_RecordBox.qml @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2023 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, see <https://www.gnu.org/licenses/>. + */ + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +import QtTest + +import "../../../src/app/" +import "../../../src/app/mainview/components" + +ColumnLayout { + id: root + + spacing: 0 + width: 300 + height: 300 + + RecordBox { + id: uut + + TestCase { + name: "Take picture" + when: windowShown + + function test_takePicture() { + // Open the recorder and take a picture + uut.openRecorder(true) + + compare(uut.state, RecordBox.States.INIT) + + var screenshotBtn = findChild(uut, "screenshotBtn") + screenshotBtn.clicked() + + compare(uut.state, RecordBox.States.REC_SUCCESS) + + uut.closeRecorder() + } + } + } +}