[telepathy-gabble/master] tests/twisted/avatar-requirements.py: new test for avatar requirements

Simon McVittie simon.mcvittie at collabora.co.uk
Wed Apr 8 09:41:47 PDT 2009


---
 tests/twisted/Makefile.am            |    1 +
 tests/twisted/avatar-requirements.py |   47 ++++++++++++++++++++++++++++++++++
 tests/twisted/constants.py           |    1 +
 3 files changed, 49 insertions(+), 0 deletions(-)
 create mode 100644 tests/twisted/avatar-requirements.py

diff --git a/tests/twisted/Makefile.am b/tests/twisted/Makefile.am
index 267de69..12de542 100644
--- a/tests/twisted/Makefile.am
+++ b/tests/twisted/Makefile.am
@@ -1,4 +1,5 @@
 TWISTED_TESTS = \
+	avatar-requirements.py \
 	muc/name-conflict.py \
 	muc/renamed.py \
 	muc/roomlist.py \
diff --git a/tests/twisted/avatar-requirements.py b/tests/twisted/avatar-requirements.py
new file mode 100644
index 0000000..21e9a8b
--- /dev/null
+++ b/tests/twisted/avatar-requirements.py
@@ -0,0 +1,47 @@
+from servicetest import call_async, EventPattern
+from gabbletest import exec_test, acknowledge_iq, make_result_iq
+import constants as cs
+
+def test(q, bus, conn, stream):
+    conn.Connect()
+    q.expect('dbus-signal', signal='StatusChanged', args=[0, 1])
+
+    props = conn.GetAll(cs.CONN_IFACE_AVATARS,
+            dbus_interface=cs.PROPERTIES_IFACE)
+    types = props['SupportedAvatarMIMETypes']
+    minw = props['MinimumAvatarWidth']
+    minh = props['MinimumAvatarHeight']
+    maxw = props['MaximumAvatarWidth']
+    maxh = props['MaximumAvatarHeight']
+    maxb = props['MaximumAvatarBytes']
+    rech = props['RecommendedAvatarHeight']
+    recw = props['RecommendedAvatarWidth']
+
+    assert types[0] == 'image/png', types
+    assert 'image/jpeg' in types, types
+    assert 'image/gif' in types, types
+    assert minw == 32, minw
+    assert minh == 32, minh
+    assert maxw == 96, maxw
+    assert maxh == 96, maxh
+    assert maxb == 8192, maxb
+    assert recw == 64, recw
+    assert rech == 64, rech
+
+    # deprecated version
+    types, minw, minh, maxw, maxh, maxb = conn.Avatars.GetAvatarRequirements()
+    assert types[0] == 'image/png', types
+    assert 'image/jpeg' in types, types
+    assert 'image/gif' in types, types
+    assert minw == 32, minw
+    assert minh == 32, minh
+    assert maxw == 96, maxw
+    assert maxh == 96, maxh
+    assert maxb == 8192, maxb
+
+    conn.Disconnect()
+    q.expect('dbus-signal', signal='StatusChanged', args=[2, 1])
+
+if __name__ == '__main__':
+    exec_test(test)
+
diff --git a/tests/twisted/constants.py b/tests/twisted/constants.py
index bb2d709..365e90b 100644
--- a/tests/twisted/constants.py
+++ b/tests/twisted/constants.py
@@ -33,6 +33,7 @@ INITIATOR_ID = CHANNEL + '.InitiatorID'
 INTERFACES = CHANNEL + '.Interfaces'
 
 CONN = "org.freedesktop.Telepathy.Connection"
+CONN_IFACE_AVATARS = CONN + '.Interface.Avatars'
 CONN_IFACE_CONTACTS = CONN + '.Interface.Contacts'
 CONN_IFACE_CONTACT_CAPA = CONN + '.Interface.ContactCapabilities.DRAFT'
 CONN_IFACE_REQUESTS = CONN + '.Interface.Requests'
-- 
1.5.6.5



More information about the telepathy-commits mailing list