Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2577899
matrix-room-timeline-test.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
matrix-room-timeline-test.cpp
View Options
/*
* This file is part of kazv.
* SPDX-FileCopyrightText: 2023 tusooa <tusooa@kazv.moe>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
#include
<libkazv-config.hpp>
#include
<immer/config.hpp>
// https://github.com/arximboldi/immer/issues/168
#include
<memory>
#include
<QtTest>
#include
<matrix-room-timeline.hpp>
#include
<matrix-sdk.hpp>
#include
<matrix-room-list.hpp>
#include
<matrix-room.hpp>
#include
<matrix-event.hpp>
#include
"test-model.hpp"
#include
"test-utils.hpp"
using
namespace
Kazv
;
class
MatrixRoomTimelineTest
:
public
QObject
{
Q_OBJECT
private
Q_SLOTS
:
void
testLocalEcho
();
};
void
MatrixRoomTimelineTest::testLocalEcho
()
{
auto
model
=
makeTestModel
();
std
::
unique_ptr
<
MatrixSdk
>
sdk
{
makeTestSdk
(
model
)};
auto
roomList
=
toUniquePtr
(
sdk
->
roomList
());
auto
room
=
toUniquePtr
(
roomList
->
room
(
"!foo:tusooa.xyz"
));
auto
timeline
=
toUniquePtr
(
room
->
timeline
());
QCOMPARE
(
timeline
->
count
(),
2
);
auto
first
=
toUniquePtr
(
timeline
->
at
(
1
));
// reverse order
QCOMPARE
(
first
->
isSending
(),
true
);
QCOMPARE
(
first
->
isLocalEcho
(),
true
);
QCOMPARE
(
first
->
isFailed
(),
false
);
QCOMPARE
(
first
->
txnId
(),
"some-txn-id"
);
auto
second
=
toUniquePtr
(
timeline
->
at
(
0
));
QCOMPARE
(
second
->
isSending
(),
false
);
QCOMPARE
(
second
->
isLocalEcho
(),
true
);
QCOMPARE
(
second
->
isFailed
(),
true
);
QCOMPARE
(
second
->
txnId
(),
"some-other-txn-id"
);
}
QTEST_MAIN
(
MatrixRoomTimelineTest
)
#include
"matrix-room-timeline-test.moc"
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Tue, Jun 24, 4:22 PM (1 d, 3 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
88716
Default Alt Text
matrix-room-timeline-test.cpp (1 KB)
Attached To
Mode
rK kazv
Attached
Detach File
Event Timeline
Log In to Comment