summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.com>2011-05-26 16:43:15 -0400
committerNicolas Dufresne <nicolas.dufresne@collabora.com>2011-05-26 16:47:11 -0400
commit83787894fa15de291a8f1557a126f460811d33d4 (patch)
treecf65402e01c38d065aef99ef287c4c6383a16479 /tests
parent9ab824eec3ba78d3219117cadb3e1caf04c6a4c6 (diff)
downloadtelepathy-logger-83787894fa15de291a8f1557a126f460811d33d4.tar.gz
Test case where first call is older then any text
Diffstat (limited to 'tests')
-rw-r--r--tests/dbus/test-log-manager.c2
-rw-r--r--tests/dbus/test-tpl-log-store-xml.c30
-rw-r--r--tests/logs/TpLogger/logs/gabble_jabber_user_40collabora_2eco_2euk/user5@collabora.co.uk/20100113.call.log5
-rw-r--r--tests/logs/TpLogger/logs/gabble_jabber_user_40collabora_2eco_2euk/user5@collabora.co.uk/20100113.log5
4 files changed, 39 insertions, 3 deletions
diff --git a/tests/dbus/test-log-manager.c b/tests/dbus/test-log-manager.c
index 0cb00eb..311b50e 100644
--- a/tests/dbus/test-log-manager.c
+++ b/tests/dbus/test-log-manager.c
@@ -439,7 +439,7 @@ test_get_entities (TestCaseFixture *fixture,
get_entities_cb, fixture);
g_main_loop_run (fixture->main_loop);
- g_assert_cmpint (g_list_length (fixture->ret), ==, 4);
+ g_assert_cmpint (g_list_length (fixture->ret), ==, 5);
/* we do not want duplicates */
fixture->ret = g_list_sort (fixture->ret, (GCompareFunc) _tpl_entity_compare);
diff --git a/tests/dbus/test-tpl-log-store-xml.c b/tests/dbus/test-tpl-log-store-xml.c
index c8ff9aa..fd70ee9 100644
--- a/tests/dbus/test-tpl-log-store-xml.c
+++ b/tests/dbus/test-tpl-log-store-xml.c
@@ -916,11 +916,11 @@ test_get_events_for_date (XmlTestCaseFixture *fixture,
gconstpointer user_data)
{
TpAccount *account;
- TplEntity *user2, *user3, *user4;
+ TplEntity *user2, *user3, *user4, *user5;
GList *events;
GDate *date;
GError *error = NULL;
- gint idx = -1;
+ gint idx;
account = tp_account_new (fixture->bus,
TP_ACCOUNT_OBJECT_PATH_BASE "gabble/jabber/user_40collabora_2eco_2euk",
@@ -939,12 +939,16 @@ test_get_events_for_date (XmlTestCaseFixture *fixture,
user4 = tpl_entity_new ("user4@collabora.co.uk", TPL_ENTITY_CONTACT,
"User4", "");
+ user5 = tpl_entity_new ("user5@collabora.co.uk", TPL_ENTITY_CONTACT,
+ "User5", "");
+
/* Check that text event and call event are merged properly, call events
* should come after any older or same timestamp event. */
events = _tpl_log_store_get_events_for_date (fixture->store, account, user4,
TPL_EVENT_MASK_ANY, date);
g_assert_cmpint (g_list_length (events), ==, 6);
+ idx = -1;
g_assert (TPL_IS_TEXT_EVENT (g_list_nth_data (events, ++idx)));
g_assert_cmpstr (
@@ -979,6 +983,27 @@ test_get_events_for_date (XmlTestCaseFixture *fixture,
g_list_foreach (events, (GFunc) g_object_unref, NULL);
g_list_free (events);
+ /* Check that a call older then any text event is sorted first */
+ events = _tpl_log_store_get_events_for_date (fixture->store, account, user5,
+ TPL_EVENT_MASK_ANY, date);
+
+ g_assert_cmpint (g_list_length (events), ==, 2);
+ idx = -1;
+
+ g_assert (TPL_IS_CALL_EVENT (g_list_nth_data (events, ++idx)));
+ g_assert_cmpint (
+ tpl_call_event_get_duration (TPL_CALL_EVENT (g_list_nth_data (events, idx))),
+ ==, 1);
+
+ g_assert (TPL_IS_TEXT_EVENT (g_list_nth_data (events, ++idx)));
+ g_assert_cmpstr (
+ tpl_text_event_get_message (TPL_TEXT_EVENT (g_list_nth_data (events, idx))),
+ ==, "9");
+
+ g_list_foreach (events, (GFunc) g_object_unref, NULL);
+ g_list_free (events);
+
+ /* Check that call mask work */
events = _tpl_log_store_get_events_for_date (fixture->store, account, user4,
TPL_EVENT_MASK_CALL, date);
@@ -1018,6 +1043,7 @@ test_get_events_for_date (XmlTestCaseFixture *fixture,
g_object_unref (user2);
g_object_unref (user3);
g_object_unref (user4);
+ g_object_unref (user5);
g_date_free (date);
}
diff --git a/tests/logs/TpLogger/logs/gabble_jabber_user_40collabora_2eco_2euk/user5@collabora.co.uk/20100113.call.log b/tests/logs/TpLogger/logs/gabble_jabber_user_40collabora_2eco_2euk/user5@collabora.co.uk/20100113.call.log
new file mode 100644
index 0000000..50b4e34
--- /dev/null
+++ b/tests/logs/TpLogger/logs/gabble_jabber_user_40collabora_2eco_2euk/user5@collabora.co.uk/20100113.call.log
@@ -0,0 +1,5 @@
+<?xml version='1.0' encoding='utf-8'?>
+<?xml-stylesheet type="text/xsl" href="empathy-log.xsl"?>
+<log>
+<call time='20100113T17:48:01' id='user@collabora.co.uk' name='Nicolas1' isuser='false' token='' duration='1' actor='user@collabora.co.uk' actortype='contact' actorname='User1' actortoken='' reason='user-requested' detail='org.freedesktop.Telepathy.Error.Cancelled' />
+</log>
diff --git a/tests/logs/TpLogger/logs/gabble_jabber_user_40collabora_2eco_2euk/user5@collabora.co.uk/20100113.log b/tests/logs/TpLogger/logs/gabble_jabber_user_40collabora_2eco_2euk/user5@collabora.co.uk/20100113.log
new file mode 100644
index 0000000..23d6859
--- /dev/null
+++ b/tests/logs/TpLogger/logs/gabble_jabber_user_40collabora_2eco_2euk/user5@collabora.co.uk/20100113.log
@@ -0,0 +1,5 @@
+<?xml version='1.0' encoding='utf-8'?>
+<?xml-stylesheet type="text/xsl" href="empathy-log.xsl"?>
+<log>
+<message time='20100113T17:49:10' cm_id='456' id='user1@collabora.co.uk' name='User1' token='' isuser='false' type='normal'>9</message>
+</log>