mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-02-07 14:18:25 +00:00
feat(MainDbTester): add a get_conference_notified_events test
This commit is contained in:
parent
c30a7b48f5
commit
bd9af1601e
1 changed files with 49 additions and 1 deletions
|
|
@ -16,7 +16,9 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "address/address.h"
|
||||
#include "db/main-db.h"
|
||||
#include "event-log/events.h"
|
||||
|
||||
#include "liblinphone_tester.h"
|
||||
|
||||
|
|
@ -93,12 +95,58 @@ static void get_history () {
|
|||
);
|
||||
}
|
||||
|
||||
static void get_conference_notified_events () {
|
||||
MainDb mainDb(nullptr);
|
||||
BC_ASSERT_TRUE(mainDb.connect(MainDb::Sqlite3, getDatabasePath()));
|
||||
list<shared_ptr<EventLog>> events = mainDb.getConferenceNotifiedEvents("sip:fake-group-2@sip.linphone.org", 1);
|
||||
BC_ASSERT_EQUAL(events.size(), 3, int, "%d");
|
||||
if (events.size() != 3)
|
||||
return;
|
||||
|
||||
shared_ptr<EventLog> event;
|
||||
auto it = events.cbegin();
|
||||
|
||||
event = *it;
|
||||
if (!BC_ASSERT_TRUE(event->getType() == EventLog::Type::ConferenceParticipantRemoved)) return;
|
||||
{
|
||||
shared_ptr<ConferenceParticipantEvent> participantEvent = static_pointer_cast<ConferenceParticipantEvent>(event);
|
||||
BC_ASSERT_TRUE(participantEvent->getConferenceAddress().asStringUriOnly() == "sip:fake-group-2@sip.linphone.org");
|
||||
BC_ASSERT_TRUE(participantEvent->getParticipantAddress().asStringUriOnly() == "sip:test-11@sip.linphone.org");
|
||||
BC_ASSERT_TRUE(participantEvent->getNotifyId() == 2);
|
||||
}
|
||||
|
||||
event = *++it;
|
||||
if (!BC_ASSERT_TRUE(event->getType() == EventLog::Type::ConferenceParticipantDeviceAdded)) return;
|
||||
{
|
||||
shared_ptr<ConferenceParticipantDeviceEvent> deviceEvent = static_pointer_cast<
|
||||
ConferenceParticipantDeviceEvent
|
||||
>(event);
|
||||
BC_ASSERT_TRUE(deviceEvent->getConferenceAddress().asStringUriOnly() == "sip:fake-group-2@sip.linphone.org");
|
||||
BC_ASSERT_TRUE(deviceEvent->getParticipantAddress().asStringUriOnly() == "sip:test-11@sip.linphone.org");
|
||||
BC_ASSERT_TRUE(deviceEvent->getNotifyId() == 3);
|
||||
BC_ASSERT_TRUE(deviceEvent->getGruuAddress().asStringUriOnly() == "sip:gruu-address-1@sip.linphone.org");
|
||||
}
|
||||
|
||||
event = *++it;
|
||||
if (!BC_ASSERT_TRUE(event->getType() == EventLog::Type::ConferenceParticipantDeviceRemoved)) return;
|
||||
{
|
||||
shared_ptr<ConferenceParticipantDeviceEvent> deviceEvent = static_pointer_cast<
|
||||
ConferenceParticipantDeviceEvent
|
||||
>(event);
|
||||
BC_ASSERT_TRUE(deviceEvent->getConferenceAddress().asStringUriOnly() == "sip:fake-group-2@sip.linphone.org");
|
||||
BC_ASSERT_TRUE(deviceEvent->getParticipantAddress().asStringUriOnly() == "sip:test-11@sip.linphone.org");
|
||||
BC_ASSERT_TRUE(deviceEvent->getNotifyId() == 4);
|
||||
BC_ASSERT_TRUE(deviceEvent->getGruuAddress().asStringUriOnly() == "sip:gruu-address-1@sip.linphone.org");
|
||||
}
|
||||
}
|
||||
|
||||
test_t main_db_tests[] = {
|
||||
TEST_NO_TAG("Open database", open_database),
|
||||
TEST_NO_TAG("Get events count", get_events_count),
|
||||
TEST_NO_TAG("Get messages count", get_messages_count),
|
||||
TEST_NO_TAG("Get unread messages count", get_unread_messages_count),
|
||||
TEST_NO_TAG("Get history", get_history)
|
||||
TEST_NO_TAG("Get history", get_history),
|
||||
TEST_NO_TAG("Get conference events", get_conference_notified_events)
|
||||
};
|
||||
|
||||
test_suite_t main_db_test_suite = {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue