Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F112194
D190.1732276398.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
43 KB
Referenced Files
None
Subscribers
None
D190.1732276398.diff
View Options
diff --git a/src/tests/quick-tests/test-helpers/KazvIOManagerMock.qml b/src/tests/quick-tests/test-helpers/KazvIOManagerMock.qml
--- a/src/tests/quick-tests/test-helpers/KazvIOManagerMock.qml
+++ b/src/tests/quick-tests/test-helpers/KazvIOManagerMock.qml
@@ -8,6 +8,19 @@
QtObject {
id: managerMock
+ property var startNewUploadJob: mockHelper.noop([
+ 'serverUrl',
+ 'fileUrl',
+ 'token',
+ 'roomId',
+ 'roomList',
+ 'encrypted',
+ 'draftRelType',
+ 'draftRelatedTo'
+ ])
+ property var deleteDownloadJob: mockHelper.noop()
+ property var deleteUploadJob: mockHelper.noop()
+
function getDownloadJob (jobId) {
const component = Qt.createComponent("KazvIOJobMock.qml");
return component.createObject(managerMock);
diff --git a/src/tests/quick-tests/test-helpers/MatrixSdkMock.qml b/src/tests/quick-tests/test-helpers/MatrixSdkMock.qml
--- a/src/tests/quick-tests/test-helpers/MatrixSdkMock.qml
+++ b/src/tests/quick-tests/test-helpers/MatrixSdkMock.qml
@@ -7,6 +7,25 @@
import QtQuick 2.15
QtObject {
+ property var userId: ''
+ property var serverUrl: 'https://example.com'
+ property var token: 'token'
+ property var updateStickerPack: mockHelper.promise()
+ property var createRoom: mockHelper.promise([
+ 'isPrivate',
+ 'name',
+ 'alias',
+ 'invites',
+ 'isDirect',
+ 'allowFederate',
+ 'topic',
+ 'powerLevelContentOverride',
+ 'preset',
+ 'encrypted',
+ ])
+ property var joinRoom: mockHelper.promise()
+ property var sendAccountData: mockHelper.promise()
+
function mxcUriToHttp (uri) {
console.log('mxcUriToHttp');
return uri || '';
diff --git a/src/tests/quick-tests/test-helpers/TestItem.qml b/src/tests/quick-tests/test-helpers/TestItem.qml
new file mode 100644
--- /dev/null
+++ b/src/tests/quick-tests/test-helpers/TestItem.qml
@@ -0,0 +1,50 @@
+/*
+ * This file is part of kazv.
+ * SPDX-FileCopyrightText: 2024 tusooa <tusooa@kazv.moe>
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+import QtQuick
+import QtTest
+import '.' as QmlHelpers
+import '../test-helpers.js' as JsHelpers
+
+Item {
+ id: item
+ width: 800
+ height: 600
+
+ property var l10n: JsHelpers.fluentMock
+ property var mockHelper: QmlHelpers.MockHelper {}
+ property var promiseComp: Component {
+ QmlHelpers.MatrixPromiseMock {}
+ }
+ property var matrixSdk: QmlHelpers.MatrixSdkMock {
+ }
+ property var sdkVars: QtObject {
+ property var roomList: ({})
+ property var userGivenNicknameMap: QtObject {
+ property var map: ({
+ '@foo:tusooa.xyz': 'something',
+ })
+ property var setAndUpload: mockHelper.promise()
+ }
+ }
+ property var kazvIOManager: QmlHelpers.KazvIOManagerMock {}
+ property var showPassiveNotification: mockHelper.noop()
+ property var pageStack: QtObject {
+ property var removePage: mockHelper.noop()
+ }
+
+ function applicationWindow() {
+ return Window.window;
+ }
+
+ Component.onCompleted: {
+ const testFunctions = Object.keys(item).filter(name => name.startsWith('test_'));
+ if (testFunctions.length) {
+ console.error('There are functions starting with test_ in the root item. It is likely that they belong to the TestCase instead. The functions are:', testFunctions);
+ throw new Error('Unexpected test functions');
+ }
+ }
+}
diff --git a/src/tests/quick-tests/tst_About.qml b/src/tests/quick-tests/tst_About.qml
--- a/src/tests/quick-tests/tst_About.qml
+++ b/src/tests/quick-tests/tst_About.qml
@@ -7,14 +7,10 @@
import QtQuick
import QtTest
import '../../contents/ui' as Kazv
-import 'test-helpers.js' as Helpers
+import 'test-helpers' as QmlHelpers
-Item {
+QmlHelpers.TestItem {
id: item
- width: 800
- height: 600
-
- property var l10n: Helpers.fluentMock
Kazv.About {
id: about
diff --git a/src/tests/quick-tests/tst_AddStickerPopup.qml b/src/tests/quick-tests/tst_AddStickerPopup.qml
--- a/src/tests/quick-tests/tst_AddStickerPopup.qml
+++ b/src/tests/quick-tests/tst_AddStickerPopup.qml
@@ -11,22 +11,10 @@
import '../../contents/ui' as Kazv
import 'test-helpers.js' as Helpers
-import 'test-helpers' as TestHelpers
+import 'test-helpers' as QmlHelpers
-Item {
+QmlHelpers.TestItem {
id: item
- width: 800
- height: 600
-
- property var l10n: Helpers.fluentMock
- property var mockHelper: TestHelpers.MockHelper {}
- property var promiseComp: Component {
- TestHelpers.MatrixPromiseMock {}
- }
- property var matrixSdk: TestHelpers.MatrixSdkMock {
- id: matrixSdk
- property var updateStickerPack: mockHelper.promise()
- }
Kazv.AddStickerPopup {
id: addStickerPopup
diff --git a/src/tests/quick-tests/tst_ConfirmUploadPopup.qml b/src/tests/quick-tests/tst_ConfirmUploadPopup.qml
--- a/src/tests/quick-tests/tst_ConfirmUploadPopup.qml
+++ b/src/tests/quick-tests/tst_ConfirmUploadPopup.qml
@@ -10,16 +10,13 @@
import org.kde.kirigami 2.20 as Kirigami
import moe.kazv.mxc.kazv 0.0 as MK
import '../../contents/ui' as Kazv
-import 'test-helpers.js' as Helpers
-import 'test-helpers' as TestHelpers
+import 'test-helpers' as QmlHelpers
-Item {
+QmlHelpers.TestItem {
id: item
width: Kirigami.Units.gridUnit * 80
height: 600
- property var l10n: Helpers.fluentMock
-
SignalSpy {
id: uploadRequestedSpy
signalName: 'uploadRequested'
diff --git a/src/tests/quick-tests/tst_CreateRoomPage.qml b/src/tests/quick-tests/tst_CreateRoomPage.qml
--- a/src/tests/quick-tests/tst_CreateRoomPage.qml
+++ b/src/tests/quick-tests/tst_CreateRoomPage.qml
@@ -9,33 +9,13 @@
import QtTest 1.0
import '../../contents/ui' as Kazv
-import 'test-helpers.js' as Helpers
-import 'test-helpers' as TestHelpers
+import 'test-helpers.js' as JsHelpers
+import 'test-helpers' as QmlHelpers
import moe.kazv.mxc.kazv 0.0 as MK
-Item {
+QmlHelpers.TestItem {
id: item
- width: 800
- height: 600
-
- property var mockHelper: TestHelpers.MockHelper {}
- property var l10n: Helpers.fluentMock
- property var matrixSdk: TestHelpers.MatrixSdkMock {
- property var createRoom: mockHelper.promise([
- 'isPrivate',
- 'name',
- 'alias',
- 'invites',
- 'isDirect',
- 'allowFederate',
- 'topic',
- 'powerLevelContentOverride',
- 'preset',
- 'encrypted',
- ])
- }
- property var sdkVars: ({})
Kazv.CreateRoomPage {
anchors.fill: parent
@@ -72,7 +52,7 @@
mouseClick(button);
tryVerify(() => item.matrixSdk.createRoom.calledTimes() === 1, 1000);
- verify(Helpers.deepEqual(item.matrixSdk.createRoom.lastArgs(), {
+ verify(JsHelpers.deepEqual(item.matrixSdk.createRoom.lastArgs(), {
isPrivate: false,
name: 'some name',
alias: 'alias',
@@ -97,7 +77,7 @@
mouseClick(button);
tryVerify(() => item.matrixSdk.createRoom.calledTimes() === 1, 1000);
- verify(Helpers.deepEqual(item.matrixSdk.createRoom.lastArgs(), {
+ verify(JsHelpers.deepEqual(item.matrixSdk.createRoom.lastArgs(), {
isPrivate: true,
name: 'some name',
alias: 'alias',
@@ -122,7 +102,7 @@
mouseClick(button);
tryVerify(() => item.matrixSdk.createRoom.calledTimes() === 1, 1000);
- verify(Helpers.deepEqual(item.matrixSdk.createRoom.lastArgs(), {
+ verify(JsHelpers.deepEqual(item.matrixSdk.createRoom.lastArgs(), {
isPrivate: true,
name: 'some name',
alias: 'alias',
@@ -154,7 +134,7 @@
mouseClick(button);
tryVerify(() => item.matrixSdk.createRoom.calledTimes() === 1, 1000);
- verify(Helpers.deepEqual(item.matrixSdk.createRoom.lastArgs(), {
+ verify(JsHelpers.deepEqual(item.matrixSdk.createRoom.lastArgs(), {
isPrivate: true,
name: 'some name',
alias: 'alias',
@@ -190,7 +170,7 @@
mouseClick(button);
tryVerify(() => item.matrixSdk.createRoom.calledTimes() === 1, 1000);
- verify(Helpers.deepEqual(item.matrixSdk.createRoom.lastArgs(), {
+ verify(JsHelpers.deepEqual(item.matrixSdk.createRoom.lastArgs(), {
isPrivate: true,
name: 'some name',
alias: 'alias',
@@ -242,7 +222,7 @@
}, 50000);
tryVerify(() => item.matrixSdk.createRoom.calledTimes() === 1, 1000);
- verify(Helpers.deepEqual(item.matrixSdk.createRoom.lastArgs(), {
+ verify(JsHelpers.deepEqual(item.matrixSdk.createRoom.lastArgs(), {
isPrivate: false,
name: 'some name',
alias: 'alias',
diff --git a/src/tests/quick-tests/tst_Device.qml b/src/tests/quick-tests/tst_Device.qml
--- a/src/tests/quick-tests/tst_Device.qml
+++ b/src/tests/quick-tests/tst_Device.qml
@@ -8,19 +8,15 @@
import QtTest 1.0
import '../../contents/ui/device-mgmt' as KazvDM
-import 'test-helpers.js' as Helpers
-
-Item {
- width: 800
- height: 600
-
- property var l10n: Helpers.fluentMock
+import 'test-helpers' as QmlHelpers
+QmlHelpers.TestItem {
property var deviceItem: ({
deviceId: 'some-id',
displayName: 'name',
trustLevel: 'unseen'
})
+
KazvDM.Device {
id: device
}
diff --git a/src/tests/quick-tests/tst_DeviceList.qml b/src/tests/quick-tests/tst_DeviceList.qml
--- a/src/tests/quick-tests/tst_DeviceList.qml
+++ b/src/tests/quick-tests/tst_DeviceList.qml
@@ -8,14 +8,9 @@
import QtTest 1.0
import '../../contents/ui/device-mgmt' as KazvDM
-import 'test-helpers.js' as Helpers
-
-Item {
- width: 800
- height: 600
-
- property var l10n: Helpers.fluentMock
+import 'test-helpers' as QmlHelpers
+QmlHelpers.TestItem {
property var deviceItems: [
{
deviceId: 'some-id',
diff --git a/src/tests/quick-tests/tst_DevicePopup.qml b/src/tests/quick-tests/tst_DevicePopup.qml
--- a/src/tests/quick-tests/tst_DevicePopup.qml
+++ b/src/tests/quick-tests/tst_DevicePopup.qml
@@ -8,14 +8,10 @@
import QtTest 1.0
import moe.kazv.mxc.kazv 0.0 as MK
import '../../contents/ui/device-mgmt' as KazvDM
-import 'test-helpers.js' as Helpers
+import 'test-helpers' as QmlHelpers
-Item {
+QmlHelpers.TestItem {
id: item
- width: 800
- height: 600
-
- property var l10n: Helpers.fluentMock
property var deviceItem: ({
deviceId: 'some-id',
@@ -23,10 +19,6 @@
trustLevel: 'unseen'
})
- function applicationWindow() {
- return Window.window;
- }
-
KazvDM.Device {
id: device
item: deviceItem
diff --git a/src/tests/quick-tests/tst_EventHistoryView.qml b/src/tests/quick-tests/tst_EventHistoryView.qml
--- a/src/tests/quick-tests/tst_EventHistoryView.qml
+++ b/src/tests/quick-tests/tst_EventHistoryView.qml
@@ -9,15 +9,10 @@
import QtTest
import '../../contents/ui' as Kazv
-import 'test-helpers.js' as Helpers
-import 'test-helpers' as TestHelpers
+import 'test-helpers' as QmlHelpers
-Item {
+QmlHelpers.TestItem {
id: item
- width: 800
- height: 600
-
- property var mockHelper: TestHelpers.MockHelper {}
property var room: ({
messageById: (_id) => item.textEvent,
diff --git a/src/tests/quick-tests/tst_EventReadIndicator.qml b/src/tests/quick-tests/tst_EventReadIndicator.qml
--- a/src/tests/quick-tests/tst_EventReadIndicator.qml
+++ b/src/tests/quick-tests/tst_EventReadIndicator.qml
@@ -9,22 +9,10 @@
import QtTest 1.0
import '../../contents/ui' as Kazv
-import 'test-helpers.js' as Helpers
-import 'test-helpers' as TestHelpers
+import 'test-helpers' as QmlHelpers
-Item {
+QmlHelpers.TestItem {
id: item
- width: 800
- height: 600
-
- property var l10n: Helpers.fluentMock
- property var matrixSdk: TestHelpers.MatrixSdkMock {}
- property var sdkVars: QtObject {
- property var userGivenNicknameMap: QtObject {
- property var map: ({})
- }
- }
- property var kazvIOManager: TestHelpers.KazvIOManagerMock {}
function makeModel(size) {
return {
diff --git a/src/tests/quick-tests/tst_EventSourceView.qml b/src/tests/quick-tests/tst_EventSourceView.qml
--- a/src/tests/quick-tests/tst_EventSourceView.qml
+++ b/src/tests/quick-tests/tst_EventSourceView.qml
@@ -9,14 +9,11 @@
import QtTest 1.0
import '../../contents/ui' as Kazv
-import 'test-helpers.js' as Helpers
-import 'test-helpers' as TestHelpers
+import 'test-helpers' as QmlHelpers
-Item {
+QmlHelpers.TestItem {
id: item
- width: 800
- height: 600
- property var l10n: Helpers.fluentMock
+
property var unencryptedEvent: ({
encrypted: false,
decrypted: false,
diff --git a/src/tests/quick-tests/tst_EventView.qml b/src/tests/quick-tests/tst_EventView.qml
--- a/src/tests/quick-tests/tst_EventView.qml
+++ b/src/tests/quick-tests/tst_EventView.qml
@@ -12,14 +12,10 @@
import org.kde.kirigami 2.13 as Kirigami
import '../../contents/ui' as Kazv
import 'test-helpers.js' as Helpers
-import 'test-helpers' as TestHelpers
+import 'test-helpers' as QmlHelpers
-Item {
+QmlHelpers.TestItem {
id: item
- width: 800
- height: 600
-
- property var mockHelper: TestHelpers.MockHelper {}
property var activateUserPage: mockHelper.noop()
property var paginateBackRequested: mockHelper.noop()
@@ -44,18 +40,7 @@
messageById: (_id) => item.textEvent,
member: (_id) => ({}),
})
- property var l10n: Helpers.fluentMock
- property var matrixSdk: TestHelpers.MatrixSdkMock {
- property var userId: '@foo:tusooa.xyz'
- }
- property var sdkVars: QtObject {
- property var userGivenNicknameMap: QtObject {
- property var map: ({
- '@foo:tusooa.xyz': 'something',
- })
- }
- }
- property var kazvIOManager: TestHelpers.KazvIOManagerMock {}
+
property var localEcho: ({
eventId: '',
sender: '',
@@ -472,6 +457,7 @@
when: windowShown
function init() {
+ item.matrixSdk.userId = '@foo:tusooa.xyz';
eventView.event = item.localEcho;
mockHelper.clearAll();
}
diff --git a/src/tests/quick-tests/tst_EventViewRedacted.qml b/src/tests/quick-tests/tst_EventViewRedacted.qml
--- a/src/tests/quick-tests/tst_EventViewRedacted.qml
+++ b/src/tests/quick-tests/tst_EventViewRedacted.qml
@@ -8,14 +8,11 @@
import QtTest 1.0
import '../../contents/ui' as Kazv
-import 'test-helpers.js' as Helpers
+import 'test-helpers' as QmlHelpers
-Item {
+QmlHelpers.TestItem {
id: item
- width: 800
- height: 600
- property var l10n: Helpers.fluentMock
property var event: ({
eventId: '',
sender: '',
diff --git a/src/tests/quick-tests/tst_EventViewVideo.qml b/src/tests/quick-tests/tst_EventViewVideo.qml
--- a/src/tests/quick-tests/tst_EventViewVideo.qml
+++ b/src/tests/quick-tests/tst_EventViewVideo.qml
@@ -11,15 +11,11 @@
import moe.kazv.mxc.kazv 0.0 as MK
import org.kde.kirigami 2.13 as Kirigami
import '../../contents/ui' as Kazv
-import 'test-helpers.js' as Helpers
-import 'test-helpers' as TestHelpers
+import 'test-helpers' as QmlHelpers
-Item {
+QmlHelpers.TestItem {
id: item
- width: 800
- height: 600
- property var mockHelper: TestHelpers.MockHelper {}
property var videoEvent: ({
eventId: '',
sender: '@foo:tusooa.xyz',
diff --git a/src/tests/quick-tests/tst_JoinRoomPage.qml b/src/tests/quick-tests/tst_JoinRoomPage.qml
--- a/src/tests/quick-tests/tst_JoinRoomPage.qml
+++ b/src/tests/quick-tests/tst_JoinRoomPage.qml
@@ -9,26 +9,13 @@
import QtTest 1.0
import '../../contents/ui' as Kazv
-import 'test-helpers.js' as Helpers
-import 'test-helpers' as TestHelpers
+import 'test-helpers.js' as JsHelpers
+import 'test-helpers' as QmlHelpers
import moe.kazv.mxc.kazv 0.0 as MK
-Item {
+QmlHelpers.TestItem {
id: item
- width: 800
- height: 600
-
- property var mockHelper: TestHelpers.MockHelper {}
- property var l10n: Helpers.fluentMock
- property var showPassiveNotification: () => {}
- property var matrixSdk: TestHelpers.MatrixSdkMock {
- property var joinRoom: mockHelper.promise()
- }
- property var sdkVars: ({})
- property var pageStack: ({
- removePage: mockHelper.noop(),
- })
Kazv.JoinRoomPage {
id: joinRoomPage
@@ -57,7 +44,7 @@
mouseClick(button);
tryVerify(() => item.matrixSdk.joinRoom.calledTimes() === 1, 1000);
- verify(Helpers.deepEqual(item.matrixSdk.joinRoom.lastArgs(), [
+ verify(JsHelpers.deepEqual(item.matrixSdk.joinRoom.lastArgs(), [
'#foo:example.com',
['example.com', 'example.org'],
]));
@@ -74,7 +61,7 @@
mouseClick(button);
tryVerify(() => item.matrixSdk.joinRoom.calledTimes() === 1, 1000);
- verify(Helpers.deepEqual(item.matrixSdk.joinRoom.lastArgs(), [
+ verify(JsHelpers.deepEqual(item.matrixSdk.joinRoom.lastArgs(), [
'#foo:example.com',
[],
]));
diff --git a/src/tests/quick-tests/tst_KazvIOMenu.qml b/src/tests/quick-tests/tst_KazvIOMenu.qml
--- a/src/tests/quick-tests/tst_KazvIOMenu.qml
+++ b/src/tests/quick-tests/tst_KazvIOMenu.qml
@@ -8,21 +8,14 @@
import QtTest
import '../../contents/ui' as Kazv
-import 'test-helpers' as TestHelpers
-import 'test-helpers.js' as Helpers
+import 'test-helpers' as QmlHelpers
+import 'test-helpers.js' as JsHelpers
import moe.kazv.mxc.kazv 0.0 as MK
-Item {
+QmlHelpers.TestItem {
id: item
- width: 800
- height: 600
- property var mockHelper: TestHelpers.MockHelper {}
- property var kazvIOManager: QtObject {
- property var deleteDownloadJob: mockHelper.noop()
- property var deleteUploadJob: mockHelper.noop()
- }
property var kazvIOJob: QtObject {
function isResulted() { return false; }
function isSuspended() { return false; }
@@ -42,7 +35,6 @@
function isSuspended() { return false; }
function error() { return MK.KazvIOBaseJob.NoError; }
}
- property var l10n: Helpers.fluentMock
Kazv.KazvIOMenu {
id: progressBar
diff --git a/src/tests/quick-tests/tst_Notifications.qml b/src/tests/quick-tests/tst_Notifications.qml
--- a/src/tests/quick-tests/tst_Notifications.qml
+++ b/src/tests/quick-tests/tst_Notifications.qml
@@ -9,8 +9,6 @@
import QtTest 1.0
import '../../contents/ui' as Kazv
-import 'test-helpers.js' as Helpers
-import 'test-helpers' as TestHelpers
import moe.kazv.mxc.kazv 0.0 as MK
TestCase {
diff --git a/src/tests/quick-tests/tst_PageManager.qml b/src/tests/quick-tests/tst_PageManager.qml
--- a/src/tests/quick-tests/tst_PageManager.qml
+++ b/src/tests/quick-tests/tst_PageManager.qml
@@ -9,15 +9,13 @@
import QtTest 1.0
import '../../contents/ui' as Kazv
-import 'test-helpers.js' as Helpers
-import 'test-helpers' as TestHelpers
+import 'test-helpers.js' as JsHelpers
+import 'test-helpers' as QmlHelpers
import moe.kazv.mxc.kazv 0.0 as MK
-Item {
+QmlHelpers.TestItem {
id: item
- width: 800
- height: 600
property string testRoomId: '!roomtest:example.org'
property var pageStack: QtObject {
@@ -71,7 +69,7 @@
compare(pushSignalSpy.count, 0);
pageManager.main.switchToRoomRequested('!otherroom:example.org');
tryCompare(pushSignalSpy, 'count', 1);
- verify(Helpers.deepEqual(pushSignalSpy.signalArguments[0][1], { roomId: '!otherroom:example.org' }));
+ verify(JsHelpers.deepEqual(pushSignalSpy.signalArguments[0][1], { roomId: '!otherroom:example.org' }));
}
}
}
diff --git a/src/tests/quick-tests/tst_ReactToEventPopup.qml b/src/tests/quick-tests/tst_ReactToEventPopup.qml
--- a/src/tests/quick-tests/tst_ReactToEventPopup.qml
+++ b/src/tests/quick-tests/tst_ReactToEventPopup.qml
@@ -8,10 +8,9 @@
import QtTest
import '../../contents/ui' as Kazv
+import 'test-helpers' as QmlHelpers
-Item {
- width: 800
- height: 600
+QmlHelpers.TestItem {
Kazv.ReactToEventPopup {
id: popup
}
diff --git a/src/tests/quick-tests/tst_RoomInvitePage.qml b/src/tests/quick-tests/tst_RoomInvitePage.qml
--- a/src/tests/quick-tests/tst_RoomInvitePage.qml
+++ b/src/tests/quick-tests/tst_RoomInvitePage.qml
@@ -9,28 +9,16 @@
import QtTest 1.0
import '../../contents/ui/room-settings' as RoomSettings
-import 'test-helpers.js' as Helpers
-import 'test-helpers' as TestHelpers
+import 'test-helpers' as QmlHelpers
import moe.kazv.mxc.kazv 0.0 as MK
-Item {
+QmlHelpers.TestItem {
id: item
- width: 800
- height: 600
-
- property var mockHelper: TestHelpers.MockHelper {}
- property var showPassiveNotification: mockHelper.noop()
- property var pageStack: ({
- removePage: mockHelper.noop(),
- })
property var room: ({
name: 'room',
inviteUser: mockHelper.promise(),
})
- property var l10n: Helpers.fluentMock
- property var matrixSdk: TestHelpers.MatrixSdkMock {}
- property var sdkVars: ({})
RoomSettings.RoomInvitePage {
id: roomInvitePage
diff --git a/src/tests/quick-tests/tst_RoomListViewItemDelegate.qml b/src/tests/quick-tests/tst_RoomListViewItemDelegate.qml
--- a/src/tests/quick-tests/tst_RoomListViewItemDelegate.qml
+++ b/src/tests/quick-tests/tst_RoomListViewItemDelegate.qml
@@ -9,32 +9,30 @@
import QtTest 1.0
import '../../contents/ui' as Kazv
-import 'test-helpers.js' as Helpers
-import 'test-helpers' as TestHelpers
+import 'test-helpers.js' as JsHelpers
+import 'test-helpers' as QmlHelpers
import moe.kazv.mxc.kazv 0.0 as MK
-Item {
+QmlHelpers.TestItem {
id: item
- width: 800
- height: 600
- property var roomInvite: Helpers.factory.room({
+ property var roomInvite: JsHelpers.factory.room({
membership: MK.MatrixRoom.Invite,
unreadNotificationCount: 0,
})
- property var roomJoin: Helpers.factory.room({
+ property var roomJoin: JsHelpers.factory.room({
membership: MK.MatrixRoom.Join,
unreadNotificationCount: 0,
})
- property var roomLeave: Helpers.factory.room({
+ property var roomLeave: JsHelpers.factory.room({
membership: MK.MatrixRoom.Leave,
unreadNotificationCount: 0,
})
- property var roomWithUnreadNotificationCount: Helpers.factory.room({
+ property var roomWithUnreadNotificationCount: JsHelpers.factory.room({
membership: MK.MatrixRoom.Join,
unreadNotificationCount: 2,
})
@@ -125,17 +123,6 @@
}
}
- property var l10n: Helpers.fluentMock
- property var matrixSdk: TestHelpers.MatrixSdkMock {
- property var userId: '@foo:example.org'
- }
- property var sdkVars: QtObject {
- property var userGivenNicknameMap: QtObject {
- property var map: ({
- '@foo:example.com': 'something',
- })
- }
- }
property string testRoomId: 'room-test'
signal switchToRoomRequested(string roomId)
@@ -165,7 +152,7 @@
Kazv.RoomListViewItemDelegate {
id: delegateRoom
- item: Helpers.factory.room({
+ item: JsHelpers.factory.room({
roomId: testRoomId
})
}
@@ -222,6 +209,13 @@
name: 'RoomListViewItemDelegateTest'
when: windowShown
+ function initTestCase() {
+ item.matrixSdk.userId = '@foo:example.org';
+ item.sdkVars.userGivenNicknameMap.map = {
+ '@foo:example.com': 'something',
+ };
+ }
+
function test_inviteIndicator() {
const indicator = findChild(delegateInvite, 'inviteIndicator');
verify(indicator);
@@ -264,7 +258,7 @@
compare(switchToRoomSpy.count, 0);
mouseClick(delegateRoom);
tryCompare(switchToRoomSpy, 'count', 1);
- verify(Helpers.deepEqual(switchToRoomSpy.signalArguments[0], [testRoomId]));
+ verify(JsHelpers.deepEqual(switchToRoomSpy.signalArguments[0], [testRoomId]));
}
function test_roomName() {
diff --git a/src/tests/quick-tests/tst_RoomMemberListPage.qml b/src/tests/quick-tests/tst_RoomMemberListPage.qml
--- a/src/tests/quick-tests/tst_RoomMemberListPage.qml
+++ b/src/tests/quick-tests/tst_RoomMemberListPage.qml
@@ -10,26 +10,16 @@
import '../../contents/ui' as Kazv
import '../../contents/ui/room-settings' as RS
-import 'test-helpers.js' as Helpers
-import 'test-helpers' as TestHelpers
+import 'test-helpers' as QmlHelpers
import moe.kazv.mxc.kazv 0.0 as MK
-Item {
+QmlHelpers.TestItem {
id: item
- width: 800
- height: 600
- property var mockHelper: TestHelpers.MockHelper {}
property var room: QtObject {
property var refreshState: mockHelper.promise()
}
- property var l10n: Helpers.fluentMock
- property var matrixSdk: TestHelpers.MatrixSdkMock {
- property var userId: '@foo:example.org'
- }
- property var sdkVars: ({})
-
property var pageComp: Component {
RS.RoomMemberListPage {
}
diff --git a/src/tests/quick-tests/tst_RoomNameProvider.qml b/src/tests/quick-tests/tst_RoomNameProvider.qml
--- a/src/tests/quick-tests/tst_RoomNameProvider.qml
+++ b/src/tests/quick-tests/tst_RoomNameProvider.qml
@@ -9,8 +9,8 @@
import QtTest 1.0
import '../../contents/ui' as Kazv
-import './test-helpers' as TestHelpers
-import 'test-helpers.js' as Helpers
+import './test-helpers' as QmlHelpers
+import 'test-helpers.js' as JsHelpers
TestCase {
id: roomNameProviderTest
@@ -22,7 +22,7 @@
property var map: ({})
}
}
- property var l10n: Helpers.fluentMock
+ property var l10n: JsHelpers.fluentMock
property var providerFunctional: Kazv.RoomNameProvider {}
property var providerReactive: Kazv.RoomNameProvider {}
diff --git a/src/tests/quick-tests/tst_RoomPage.qml b/src/tests/quick-tests/tst_RoomPage.qml
--- a/src/tests/quick-tests/tst_RoomPage.qml
+++ b/src/tests/quick-tests/tst_RoomPage.qml
@@ -9,17 +9,14 @@
import QtTest 1.0
import '../../contents/ui' as Kazv
-import 'test-helpers.js' as Helpers
-import 'test-helpers' as TestHelpers
+import 'test-helpers.js' as JsHelpers
+import 'test-helpers' as QmlHelpers
import moe.kazv.mxc.kazv 0.0 as MK
-Item {
+QmlHelpers.TestItem {
id: item
- width: 800
- height: 600
- property var mockHelper: TestHelpers.MockHelper {}
property var roomTimeline: QtObject {
property var count: 5
function at(i) {
@@ -44,11 +41,11 @@
}
}
- property var roomInvite: Helpers.factory.room({
+ property var roomInvite: JsHelpers.factory.room({
membership: MK.MatrixRoom.Invite,
})
- property var roomJoin: Helpers.factory.room({
+ property var roomJoin: JsHelpers.factory.room({
membership: MK.MatrixRoom.Join,
paginateBackFrom: mockHelper.promise(),
pinnedEventsTimeline: () => ({
@@ -56,11 +53,11 @@
}),
})
- property var roomLeave: Helpers.factory.room({
+ property var roomLeave: JsHelpers.factory.room({
membership: MK.MatrixRoom.Leave,
})
- property var roomWithPinned: Helpers.factory.room({
+ property var roomWithPinned: JsHelpers.factory.room({
membership: MK.MatrixRoom.Join,
paginateBackFrom: mockHelper.promise(),
pinnedEventsTimeline: () => ({
@@ -68,12 +65,6 @@
}),
})
- property var l10n: Helpers.fluentMock
- property var matrixSdk: TestHelpers.MatrixSdkMock {
- property var userId: '@foo:example.org'
- }
- property var sdkVars: ({})
-
ColumnLayout {
Kazv.RoomPage {
id: pageInvite
@@ -102,6 +93,7 @@
when: windowShown
function init() {
+ matrixSdk.userId = '@foo:example.org';
mockHelper.clearAll();
}
diff --git a/src/tests/quick-tests/tst_RoomPinnedEventsPage.qml b/src/tests/quick-tests/tst_RoomPinnedEventsPage.qml
--- a/src/tests/quick-tests/tst_RoomPinnedEventsPage.qml
+++ b/src/tests/quick-tests/tst_RoomPinnedEventsPage.qml
@@ -8,15 +8,10 @@
import QtQuick.Layouts
import QtTest
import '../../contents/ui' as Kazv
-import 'test-helpers.js' as Helpers
-import 'test-helpers' as TestHelpers
+import 'test-helpers' as QmlHelpers
-Item {
+QmlHelpers.TestItem {
id: item
- width: 800
- height: 600
-
- property var mockHelper: TestHelpers.MockHelper {}
property var room: ({
name: 'some room',
diff --git a/src/tests/quick-tests/tst_RoomSettingsPage.qml b/src/tests/quick-tests/tst_RoomSettingsPage.qml
--- a/src/tests/quick-tests/tst_RoomSettingsPage.qml
+++ b/src/tests/quick-tests/tst_RoomSettingsPage.qml
@@ -12,39 +12,35 @@
import '../../contents/ui/room-settings' as KazvRS
import moe.kazv.mxc.kazv 0.0 as MK
-import 'test-helpers.js' as Helpers
-import 'test-helpers' as TestHelpers
+import 'test-helpers.js' as JsHelpers
+import 'test-helpers' as QmlHelpers
-Item {
+QmlHelpers.TestItem {
id: item
- width: 800
- height: 600
- property var mockHelper: TestHelpers.MockHelper {}
-
- property var roomUnencrypted: Helpers.factory.room({
+ property var roomUnencrypted: JsHelpers.factory.room({
membership: MK.MatrixRoom.Join,
encrypted: false,
sendStateEvent: mockHelper.promise(),
})
- property var roomEncrypted: Helpers.factory.room({
+ property var roomEncrypted: JsHelpers.factory.room({
membership: MK.MatrixRoom.Join,
encrypted: true,
})
- property var roomLeft: Helpers.factory.room({
+ property var roomLeft: JsHelpers.factory.room({
membership: MK.MatrixRoom.Leave,
forgetRoom: mockHelper.promise(),
})
- property var roomJoined: Helpers.factory.room({
+ property var roomJoined: JsHelpers.factory.room({
membership: MK.MatrixRoom.Join,
leaveRoom: mockHelper.promise(),
topic: '',
})
- property var roomWithMembers: Helpers.factory.room({
+ property var roomWithMembers: JsHelpers.factory.room({
name: 'some name',
roomId: '!someid:example.com',
members: () => ({
@@ -59,25 +55,17 @@
setName: mockHelper.promise(),
})
- property var roomWithoutName: Helpers.factory.room({
+ property var roomWithoutName: JsHelpers.factory.room({
name: '',
roomId: '!someid:example.com',
})
- property var roomWithTopic: Helpers.factory.room({
+ property var roomWithTopic: JsHelpers.factory.room({
membership: MK.MatrixRoom.Join,
topic: 'some topic',
setTopic: mockHelper.promise(),
})
- property var showPassiveNotification: mockHelper.noop()
-
- property var l10n: Helpers.fluentMock
- property var matrixSdk: TestHelpers.MatrixSdkMock {
- property var userId: '@foo:example.org'
- }
- property var sdkVars: ({})
-
ColumnLayout {
KazvRS.RoomSettingsPage {
id: pageUnencrypted
@@ -124,6 +112,7 @@
pageJoined.contentItem.clip = false;
pageWithTopic.contentItem.clip = false;
pageWithMembers.contentItem.clip = false;
+ item.matrixSdk.userId = '@foo:example.org';
}
function init() {
diff --git a/src/tests/quick-tests/tst_RoomStickerPackItemDelegate.qml b/src/tests/quick-tests/tst_RoomStickerPackItemDelegate.qml
--- a/src/tests/quick-tests/tst_RoomStickerPackItemDelegate.qml
+++ b/src/tests/quick-tests/tst_RoomStickerPackItemDelegate.qml
@@ -10,18 +10,11 @@
import moe.kazv.mxc.kazv as MK
import org.kde.kirigami as Kirigami
import '../../contents/ui/room-settings' as KazvRS
-import 'test-helpers.js' as Helpers
-import 'test-helpers' as TestHelpers
+import 'test-helpers.js' as JsHelpers
+import 'test-helpers' as QmlHelpers
-Item {
+QmlHelpers.TestItem {
id: item
- width: 800
- height: 600
-
- property var mockHelper: TestHelpers.MockHelper {}
- property var matrixSdk: TestHelpers.MatrixSdkMock {
- property var sendAccountData: mockHelper.promise()
- }
KazvRS.RoomStickerPackItemDelegate {
id: packItem
@@ -53,7 +46,7 @@
verify(!usePackAction.checked);
usePackAction.trigger();
tryVerify(() => matrixSdk.sendAccountData.calledTimes() === 1);
- verify(Helpers.deepEqual(
+ verify(JsHelpers.deepEqual(
matrixSdk.sendAccountData.lastArgs()[1],
{
rooms: {
@@ -80,7 +73,7 @@
verify(usePackAction.checked);
usePackAction.trigger();
tryVerify(() => matrixSdk.sendAccountData.calledTimes() === 1);
- verify(Helpers.deepEqual(
+ verify(JsHelpers.deepEqual(
matrixSdk.sendAccountData.lastArgs()[1],
{
rooms: {
diff --git a/src/tests/quick-tests/tst_RoomStickerPacksPage.qml b/src/tests/quick-tests/tst_RoomStickerPacksPage.qml
--- a/src/tests/quick-tests/tst_RoomStickerPacksPage.qml
+++ b/src/tests/quick-tests/tst_RoomStickerPacksPage.qml
@@ -11,20 +11,11 @@
import org.kde.kirigami as Kirigami
import '../../contents/ui/room-settings' as KazvRS
import '../../js/matrix-helpers.js' as MatrixHelpers
-import 'test-helpers.js' as Helpers
-import 'test-helpers' as TestHelpers
+import 'test-helpers.js' as JsHelpers
+import 'test-helpers' as QmlHelpers
-Item {
+QmlHelpers.TestItem {
id: item
- width: 800
- height: 600
-
- property var l10n: Helpers.fluentMock
- property var mockHelper: TestHelpers.MockHelper {}
- property var showPassiveNotification: mockHelper.noop()
- property var matrixSdk: TestHelpers.MatrixSdkMock {
- property var sendAccountData: mockHelper.promise()
- }
KazvRS.RoomStickerPacksPage {
id: page
@@ -111,7 +102,7 @@
findChild(page, 'stickerPackStateKey').text = data.stateKey;
page.addStickerPackPopup.accept();
tryVerify(() => page.room.sendStateEvent.calledTimes() === 1);
- verify(Helpers.deepEqual(
+ verify(JsHelpers.deepEqual(
page.room.sendStateEvent.lastArgs(),
[{
type: MatrixHelpers.roomImagePackEventType,
diff --git a/src/tests/quick-tests/tst_RoomTimelineView.qml b/src/tests/quick-tests/tst_RoomTimelineView.qml
--- a/src/tests/quick-tests/tst_RoomTimelineView.qml
+++ b/src/tests/quick-tests/tst_RoomTimelineView.qml
@@ -13,17 +13,11 @@
import moe.kazv.mxc.kazv 0.0 as MK
import org.kde.kirigami 2.13 as Kirigami
import '../../contents/ui' as Kazv
-import 'test-helpers.js' as Helpers
-import 'test-helpers' as TestHelpers
+import 'test-helpers.js' as JsHelpers
+import 'test-helpers' as QmlHelpers
-Item {
+QmlHelpers.TestItem {
id: item
- width: 800
- height: 600
-
- property var mockHelper: TestHelpers.MockHelper {}
- property var l10n: Helpers.fluentMock
- property var matrixSdk: TestHelpers.MatrixSdkMock {}
property var makeLocalEcho: (i) => ({
eventId: '',
@@ -68,8 +62,6 @@
}
})
- property var showPassiveNotification: mockHelper.noop()
-
Kazv.RoomTimelineView {
anchors.fill: parent
id: roomTimelineView
@@ -119,7 +111,7 @@
tryVerify(() => popup.opened);
mouseClick(findChild(popup, 'confirmButton'));
verify(room.pinEvents.calledTimes() === 1);
- verify(Helpers.deepEqual(room.pinEvents.lastArgs()[0], ['$2']));
+ verify(JsHelpers.deepEqual(room.pinEvents.lastArgs()[0], ['$2']));
tryVerify(() => !popup.opened);
tryVerify(() => !findChild(Overlay.overlay, 'pinEventPopup'));
room.pinEvents.lastRetVal().resolve(true, {});
@@ -134,7 +126,7 @@
tryVerify(() => popup.opened);
mouseClick(findChild(popup, 'confirmButton'));
verify(room.pinEvents.calledTimes() === 1);
- verify(Helpers.deepEqual(room.pinEvents.lastArgs()[0], ['$2']));
+ verify(JsHelpers.deepEqual(room.pinEvents.lastArgs()[0], ['$2']));
tryVerify(() => !popup.opened);
tryVerify(() => !findChild(Overlay.overlay, 'pinEventPopup'));
room.pinEvents.lastRetVal().resolve(false, { errorCode: 'M_FORBIDDEN', error: 'You are not allowed to do so' });
@@ -149,7 +141,7 @@
tryVerify(() => popup.opened);
mouseClick(findChild(popup, 'confirmButton'));
verify(room.unpinEvents.calledTimes() === 1);
- verify(Helpers.deepEqual(room.unpinEvents.lastArgs()[0], ['$2']));
+ verify(JsHelpers.deepEqual(room.unpinEvents.lastArgs()[0], ['$2']));
tryVerify(() => !popup.opened);
tryVerify(() => !findChild(Overlay.overlay, 'unpinEventPopup'));
room.unpinEvents.lastRetVal().resolve(true, {});
@@ -164,7 +156,7 @@
tryVerify(() => popup.opened);
mouseClick(findChild(popup, 'confirmButton'));
verify(room.unpinEvents.calledTimes() === 1);
- verify(Helpers.deepEqual(room.unpinEvents.lastArgs()[0], ['$2']));
+ verify(JsHelpers.deepEqual(room.unpinEvents.lastArgs()[0], ['$2']));
tryVerify(() => !popup.opened);
tryVerify(() => !findChild(Overlay.overlay, 'unpinEventPopup'));
room.unpinEvents.lastRetVal().resolve(false, { errorCode: 'M_FORBIDDEN', error: 'You are not allowed to do so' });
diff --git a/src/tests/quick-tests/tst_SendMessageBox.qml b/src/tests/quick-tests/tst_SendMessageBox.qml
--- a/src/tests/quick-tests/tst_SendMessageBox.qml
+++ b/src/tests/quick-tests/tst_SendMessageBox.qml
@@ -12,15 +12,12 @@
import org.kde.kirigami 2.13 as Kirigami
import '../../contents/ui' as Kazv
-import 'test-helpers.js' as Helpers
-import 'test-helpers' as TestHelpers
+import 'test-helpers.js' as JsHelpers
+import 'test-helpers' as QmlHelpers
-Item {
+QmlHelpers.TestItem {
id: item
- width: 800
- height: 600
- property var mockHelper: TestHelpers.MockHelper {}
function makeRoom () {
return {
timeline () {
@@ -59,26 +56,6 @@
return get(index);
}
}
- property var l10n: Helpers.fluentMock
- property var matrixSdk: TestHelpers.MatrixSdkMock {
- property var serverUrl: "https://example.com"
- property var token: "token"
- }
- property var kazvIOManager: TestHelpers.KazvIOManagerMock {
- property var startNewUploadJob: mockHelper.noop([
- 'serverUrl',
- 'fileUrl',
- 'token',
- 'roomId',
- 'roomList',
- 'encrypted',
- 'draftRelType',
- 'draftRelatedTo'
- ])
- }
- property var sdkVars: ({
- roomList: {}
- })
Kazv.SendMessageBox {
id: sendMessageBox
@@ -254,7 +231,7 @@
verify(!fileDialog.visible);
compare(kazvIOManager.startNewUploadJob.calledTimes(), 1);
- verify(Helpers.deepEqual(kazvIOManager.startNewUploadJob.lastArgs(), {
+ verify(JsHelpers.deepEqual(kazvIOManager.startNewUploadJob.lastArgs(), {
serverUrl: matrixSdk.serverUrl,
fileUrl: Qt.url(''),
token: matrixSdk.token,
diff --git a/src/tests/quick-tests/tst_SendMessageBoxDrafts.qml b/src/tests/quick-tests/tst_SendMessageBoxDrafts.qml
--- a/src/tests/quick-tests/tst_SendMessageBoxDrafts.qml
+++ b/src/tests/quick-tests/tst_SendMessageBoxDrafts.qml
@@ -12,15 +12,12 @@
import org.kde.kirigami 2.13 as Kirigami
import '../../contents/ui' as Kazv
-import 'test-helpers.js' as Helpers
-import 'test-helpers' as TestHelpers
+import 'test-helpers.js' as JsHelpers
+import 'test-helpers' as QmlHelpers
-Item {
+QmlHelpers.TestItem {
id: item
- width: 800
- height: 600
- property var mockHelper: TestHelpers.MockHelper {}
function makeRoom () {
return {
timeline () {
@@ -47,9 +44,6 @@
property var sendMessageBoxComp: Component {
id: comp
Kirigami.Page {
- property var l10n: Helpers.fluentMock
- property var matrixSdk: TestHelpers.MatrixSdkMock {}
- property var kazvIOManager: TestHelpers.KazvIOManagerMock {}
id: page
Label {
text: 'room 1'
@@ -67,9 +61,6 @@
property var sendMessageBoxComp2: Component {
id: comp2
Kirigami.Page {
- property var l10n: Helpers.fluentMock
- property var matrixSdk: TestHelpers.MatrixSdkMock {}
- property var kazvIOManager: TestHelpers.KazvIOManagerMock {}
id: page
Label {
text: 'room 2'
diff --git a/src/tests/quick-tests/tst_StickerPackNameProvider.qml b/src/tests/quick-tests/tst_StickerPackNameProvider.qml
--- a/src/tests/quick-tests/tst_StickerPackNameProvider.qml
+++ b/src/tests/quick-tests/tst_StickerPackNameProvider.qml
@@ -9,8 +9,7 @@
import QtTest 1.0
import '../../contents/ui' as Kazv
-import './test-helpers' as TestHelpers
-import 'test-helpers.js' as Helpers
+import 'test-helpers.js' as JsHelpers
TestCase {
id: stickerPackNameProviderTest
@@ -31,7 +30,7 @@
}
}
}
- property var l10n: Helpers.fluentMock
+ property var l10n: JsHelpers.fluentMock
property var providerFunctional: Kazv.StickerPackNameProvider {}
property var providerReactive: Kazv.StickerPackNameProvider {}
diff --git a/src/tests/quick-tests/tst_StickerPicker.qml b/src/tests/quick-tests/tst_StickerPicker.qml
--- a/src/tests/quick-tests/tst_StickerPicker.qml
+++ b/src/tests/quick-tests/tst_StickerPicker.qml
@@ -9,19 +9,13 @@
import QtTest 1.0
import '../../contents/ui' as Kazv
-import 'test-helpers.js' as Helpers
-import 'test-helpers' as TestHelpers
+import 'test-helpers.js' as JsHelpers
+import 'test-helpers' as QmlHelpers
import moe.kazv.mxc.kazv 0.0 as MK
-Item {
+QmlHelpers.TestItem {
id: item
- width: 800
- height: 600
-
- property var l10n: Helpers.fluentMock
- property var matrixSdk: TestHelpers.MatrixSdkMock {}
- property var sdkVars: ({})
function makeSticker(sticker) {
return {
@@ -114,13 +108,13 @@
const stickerButton = findChild(stickerPicker, 'sticker1');
mouseClick(stickerButton);
tryVerify(() => sendMessageRequestedSpy.count === 1, 1000);
- verify(Helpers.deepEqual(sendMessageRequestedSpy.signalArguments[0][0], makeSticker(stickerPack0.get(1))));
+ verify(JsHelpers.deepEqual(sendMessageRequestedSpy.signalArguments[0][0], makeSticker(stickerPack0.get(1))));
mouseClick(findChild(stickerPicker, 'stickerPack1'));
tryVerify(() => findChild(stickerPicker, 'sticker0').sticker.mxcUri === 'mxc://example.org/some2');
mouseClick(findChild(stickerPicker, 'sticker0'));
tryVerify(() => sendMessageRequestedSpy.count === 2, 1000);
- verify(Helpers.deepEqual(sendMessageRequestedSpy.signalArguments[1][0], makeSticker(stickerPack1.get(0))));
+ verify(JsHelpers.deepEqual(sendMessageRequestedSpy.signalArguments[1][0], makeSticker(stickerPack1.get(0))));
}
}
}
diff --git a/src/tests/quick-tests/tst_TypingIndicator.qml b/src/tests/quick-tests/tst_TypingIndicator.qml
--- a/src/tests/quick-tests/tst_TypingIndicator.qml
+++ b/src/tests/quick-tests/tst_TypingIndicator.qml
@@ -9,13 +9,11 @@
import QtTest 1.0
import '../../contents/ui' as Kazv
-import 'test-helpers.js' as Helpers
-import 'test-helpers' as TestHelpers
+import 'test-helpers.js' as JsHelpers
+import 'test-helpers' as QmlHelpers
-Item {
+QmlHelpers.TestItem {
id: item
- width: 800
- height: 600
property var user1: ({
name: 'some name',
@@ -40,14 +38,6 @@
count: 3,
})
- property var l10n: Helpers.fluentMock
-
- property var sdkVars: QtObject {
- property var userGivenNicknameMap: QtObject {
- property var map: ({})
- }
- }
-
ColumnLayout {
Kazv.TypingIndicator {
id: ind0
diff --git a/src/tests/quick-tests/tst_UserNameProvider.qml b/src/tests/quick-tests/tst_UserNameProvider.qml
--- a/src/tests/quick-tests/tst_UserNameProvider.qml
+++ b/src/tests/quick-tests/tst_UserNameProvider.qml
@@ -9,8 +9,8 @@
import QtTest 1.0
import '../../contents/ui' as Kazv
-import './test-helpers' as TestHelpers
-import 'test-helpers.js' as Helpers
+import './test-helpers' as QmlHelpers
+import 'test-helpers.js' as JsHelpers
TestCase {
id: userNameProviderTest
@@ -22,7 +22,7 @@
property var map: ({})
}
}
- property var l10n: Helpers.fluentMock
+ property var l10n: JsHelpers.fluentMock
property var userOverrided: ({
name: 'foo',
diff --git a/src/tests/quick-tests/tst_UserPage.qml b/src/tests/quick-tests/tst_UserPage.qml
--- a/src/tests/quick-tests/tst_UserPage.qml
+++ b/src/tests/quick-tests/tst_UserPage.qml
@@ -9,29 +9,14 @@
import QtTest 1.0
import '../../contents/ui' as Kazv
-import './test-helpers' as TestHelpers
+import './test-helpers' as QmlHelpers
import 'test-helpers.js' as JsHelpers
import moe.kazv.mxc.kazv 0.0 as MK
-Item {
+QmlHelpers.TestItem {
id: upper
- width: 800
- height: 600
- property var l10n: JsHelpers.fluentMock
- property var matrixSdk: TestHelpers.MatrixSdkMock {
- property var userId: '@foo:example.com'
- }
- property var mockHelper: TestHelpers.MockHelper {}
- property var sdkVars: QtObject {
- property var userGivenNicknameMap: QtObject {
- id: gnMap
- property var map: ({})
- property var setAndUpload: mockHelper.promise()
- }
- }
-
- property var showPassiveNotification: mockHelper.noop()
+ readonly property var gnMap: upper.sdkVars.userGivenNicknameMap
property var powerLevelMapping: ({
'@mew:example.com': 100,
@@ -78,6 +63,8 @@
when: windowShown
function init() {
+ upper.matrixSdk.userId = '@foo:example.com';
+ gnMap.map = {};
mockHelper.clearAll();
room.membership = MK.MatrixRoom.Join;
userPage = userPageComp.createObject(layout);
@@ -92,7 +79,6 @@
layout.children = [];
userPage.destroy();
userPage = null;
- gnMap.map = {};
}
function test_powerLevel() {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 22, 3:53 AM (17 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38829
Default Alt Text
D190.1732276398.diff (43 KB)
Attached To
Mode
D190: Refactor common mocks into its own component
Attached
Detach File
Event Timeline
Log In to Comment