diff options
author | Philip Van Hoof <philip@codeminded.be> | 2009-12-15 15:00:39 +0100 |
---|---|---|
committer | Philip Van Hoof <philip@codeminded.be> | 2009-12-23 14:33:46 +0100 |
commit | 21256f5e86b6ada22fcf3133868183f5c28ff50e (patch) | |
tree | 6ceed1b5f6a5b3ae8229384404a79bcc67c68bea /tests/tracker-writeback | |
parent | a81a1206e7d03c1606ea44fa9d64a0c9d25f8090 (diff) | |
download | tracker-21256f5e86b6ada22fcf3133868183f5c28ff50e.tar.gz |
Added a few fields to the XMP writeback support
Diffstat (limited to 'tests/tracker-writeback')
-rwxr-xr-x | tests/tracker-writeback/01-writeback.py | 103 | ||||
-rw-r--r-- | tests/tracker-writeback/Makefile.am | 11 | ||||
-rw-r--r-- | tests/tracker-writeback/data/test01.jpg | bin | 0 -> 306 bytes | |||
-rw-r--r-- | tests/tracker-writeback/tests.xml | 28 |
4 files changed, 142 insertions, 0 deletions
diff --git a/tests/tracker-writeback/01-writeback.py b/tests/tracker-writeback/01-writeback.py new file mode 100755 index 000000000..a4dcb0456 --- /dev/null +++ b/tests/tracker-writeback/01-writeback.py @@ -0,0 +1,103 @@ +#!/usr/bin/env python2.5 + +# Copyright (C) 2008, Nokia (urho.konttori@nokia.com) +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the +# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# + + +import dbus +import unittest +import random +import os +import shutil +import re +import time +import commands + +TRACKER = 'org.freedesktop.Tracker1' +TRACKER_OBJ = '/org/freedesktop/Tracker1/Resources' +RESOURCES_IFACE = "org.freedesktop.Tracker1.Resources" + +class TestInsertion (unittest.TestCase): + + def setUp (self): + bus = dbus.SessionBus () + tracker = bus.get_object (TRACKER, TRACKER_OBJ) + self.resources = dbus.Interface (tracker, + dbus_interface=RESOURCES_IFACE); + + def test_simple_insertion (self): + try: + os.mkdir (os.getcwd() + "/tmp") + except: + print "" + + shutil.copy2 (os.getcwd() + "/data/test01.jpg", + os.getcwd() + "/tmp/test01.jpg") + + uri = "file://" + os.getcwd() + "/tmp/test01.jpg" + + insert = """INSERT { <%s> a nfo:Image, nmm:Photo, nfo:FileDataObject; + nie:isStoredAs <%s> ; + nie:url '%s' ; + nie:title 'test_title_1' ; + nco:creator [ a nco:Contact ; + nco:fullname 'test_fullname_1' ] ; + nie:description 'test_description_1' ; + nie:keyword 'test_keyword_1' ; + nie:keyword 'test_keyword_2' ; + nie:keyword 'test_keyword_3' ; + nie:contentCreated '2001-10-26T21:32:52' ; + nfo:orientation nfo:orientation-top-mirror ; + nmm:meteringMode nmm:meteringMode-average ; + nmm:whiteBalance nmm:whiteBalance-auto ; + nmm:flash nmm:flash-on ; + nmm:focalLength '1' ; + nmm:exposureTime '1' ; + nmm:isoSpeed '1' ; + nmm:fnumber '1' ; + nmm:camera 'Some Test Model' ; + nco:contributor [ a nco:Contact ; + nco:fullname 'test_fullname_2' ] ; + nie:copyright 'test_copyright_1' + }""" % (uri, uri, uri) + + + self.resources.SparqlUpdate (insert) + + time.sleep (3) + + ret = os.system ("exiftool " + os.getcwd() + "/tmp/test01.jpg | grep test_title_1") + self.assertEqual (ret, 0) + + ret = os.system ("exiftool " + os.getcwd() + "/tmp/test01.jpg | grep test_fullname_1") + self.assertEqual (ret, 0) + + ret = os.system ("exiftool " + os.getcwd() + "/tmp/test01.jpg | grep test_description_1") + self.assertEqual (ret, 0) + + ret = os.system ("exiftool " + os.getcwd() + "/tmp/test01.jpg | grep test_keyword_1") + self.assertEqual (ret, 0) + + ret = os.system ("exiftool " + os.getcwd() + "/tmp/test01.jpg | grep test_keyword_2") + self.assertEqual (ret, 0) + + ret = os.system ("exiftool " + os.getcwd() + "/tmp/test01.jpg | grep test_keyword_3") + self.assertEqual (ret, 0) + +if __name__ == '__main__': + unittest.main() diff --git a/tests/tracker-writeback/Makefile.am b/tests/tracker-writeback/Makefile.am new file mode 100644 index 000000000..6eae4f1bf --- /dev/null +++ b/tests/tracker-writeback/Makefile.am @@ -0,0 +1,11 @@ +include $(top_srcdir)/Makefile.decl + +if DIST_FUNCTIONAL_TESTS +configdir = $(datadir)/tracker-tests + +config_DATA = \ + tests.xml \ + 01-writeback.py + +EXTRA_DIST = $(config_DATA) +endif diff --git a/tests/tracker-writeback/data/test01.jpg b/tests/tracker-writeback/data/test01.jpg Binary files differnew file mode 100644 index 000000000..a62b7d4a0 --- /dev/null +++ b/tests/tracker-writeback/data/test01.jpg diff --git a/tests/tracker-writeback/tests.xml b/tests/tracker-writeback/tests.xml new file mode 100644 index 000000000..37b3a8b92 --- /dev/null +++ b/tests/tracker-writeback/tests.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<testdefinition version="0.1"> + <suite name="tracker-tests" domain="tracker-store"> + <!-- At least one set per suite, name and description mandatory --> + <set name="testset1" description="Basic sparql tests" feature="sparql-insert"> + <pre_steps> + <!-- This doesn't seem to work --> + <step>. /tmp/session_bus_address.user</step> + <step>tracker-writeback &</step> + </pre_steps> + + <!-- At least one case per set, name mandatory, description mandatory, other optional --> + <case name="test_simple_insertion" type="Functional" level="Feature" + description="Insert and check results" requirement="01" subfeature=""> + <!-- dbus env variables defined here. This works. --> + <step expected_result="0">. /tmp/session_bus_address.user; python2.5 /usr/share/tracker-tests/01-writeback.py</step> + </case> + + + <!-- Environments optional - tells where the tests are run --> + <environments> + <scratchbox>true</scratchbox> + <hardware>true</hardware> + </environments> + + </set> + </suite> +</testdefinition> |