Changeset View
Changeset View
Standalone View
Standalone View
src/tests/quick-tests/tst_EventView.qml
Show First 20 Lines • Show All 138 Lines • ▼ Show 20 Lines | property var imageEvent: ({ | ||||
stateKey: '', | stateKey: '', | ||||
content: { | content: { | ||||
msgtype: 'm.image', | msgtype: 'm.image', | ||||
body: 'some body', | body: 'some body', | ||||
}, | }, | ||||
formattedTime: '4:06 P.M.', | formattedTime: '4:06 P.M.', | ||||
}) | }) | ||||
property var stickerEvent: ({ | |||||
eventId: '', | |||||
sender: '@foo:tusooa.xyz', | |||||
type: 'm.sticker', | |||||
stateKey: '', | |||||
content: { | |||||
body: 'some body', | |||||
}, | |||||
formattedTime: '4:06 P.M.', | |||||
}) | |||||
property var eventBySomeoneElse: ({ | property var eventBySomeoneElse: ({ | ||||
eventId: '', | eventId: '', | ||||
sender: '@bar:tusooa.xyz', | sender: '@bar:tusooa.xyz', | ||||
type: 'm.room.message', | type: 'm.room.message', | ||||
stateKey: '', | stateKey: '', | ||||
content: { | content: { | ||||
msgtype: 'm.image', | msgtype: 'm.image', | ||||
body: 'some body', | body: 'some body', | ||||
▲ Show 20 Lines • Show All 196 Lines • ▼ Show 20 Lines | Kazv.EventView { | ||||
prevEvent: item.ignoredEvent | prevEvent: item.ignoredEvent | ||||
} | } | ||||
Kazv.EventView { | Kazv.EventView { | ||||
id: eventViewTextBySomeoneElse | id: eventViewTextBySomeoneElse | ||||
event: item.eventTextBySomeoneElse | event: item.eventTextBySomeoneElse | ||||
sender: item.senderOther | sender: item.senderOther | ||||
} | } | ||||
Kazv.EventView { | |||||
id: eventViewImage | |||||
event: item.imageEvent | |||||
sender: item.sender | |||||
} | } | ||||
Kazv.EventView { | |||||
id: eventViewImageCompact | |||||
compactMode: true | |||||
event: item.imageEvent | |||||
sender: item.sender | |||||
} | |||||
Kazv.EventView { | |||||
id: eventViewSticker | |||||
event: item.stickerEvent | |||||
sender: item.sender | |||||
} | |||||
Kazv.EventView { | |||||
id: eventViewStickerCompact | |||||
compactMode: true | |||||
event: item.stickerEvent | |||||
sender: item.sender | |||||
} | |||||
} | |||||
TestCase { | TestCase { | ||||
id: eventViewTest | id: eventViewTest | ||||
name: 'EventViewTest' | name: 'EventViewTest' | ||||
when: windowShown | when: windowShown | ||||
function init() { | function init() { | ||||
eventView.event = item.localEcho; | eventView.event = item.localEcho; | ||||
mockHelper.clearAll(); | mockHelper.clearAll(); | ||||
▲ Show 20 Lines • Show All 167 Lines • ▼ Show 20 Lines | TestCase { | ||||
} | } | ||||
function test_avatarClick() { | function test_avatarClick() { | ||||
const avatar = findChild(eventViewText, 'senderAvatar'); | const avatar = findChild(eventViewText, 'senderAvatar'); | ||||
mouseClick(avatar); | mouseClick(avatar); | ||||
tryVerify(() => item.activateUserPage.calledTimes() === 1); | tryVerify(() => item.activateUserPage.calledTimes() === 1); | ||||
// verify that the user id is passed | // verify that the user id is passed | ||||
verify(item.activateUserPage.lastArgs()[2] === '@foo:tusooa.xyz'); | verify(item.activateUserPage.lastArgs()[2] === '@foo:tusooa.xyz'); | ||||
} | |||||
function test_imageEvent() { | |||||
verify(!findChild(eventViewImage, 'summaryLabel').visible); | |||||
verify(findChild(eventViewImage, 'bodyLabel').visible); | |||||
verify(findChild(eventViewImageCompact, 'summaryLabel').visible); | |||||
verify(!findChild(eventViewImageCompact, 'bodyLabel').visible); | |||||
verify(!findChild(eventViewSticker, 'summaryLabel').visible); | |||||
verify(findChild(eventViewSticker, 'bodyLabel').visible); | |||||
verify(findChild(eventViewStickerCompact, 'summaryLabel').visible); | |||||
verify(!findChild(eventViewStickerCompact, 'bodyLabel').visible); | |||||
} | } | ||||
} | } | ||||
} | } |