Revision: 1652
http://gtkpod.svn.sourceforge.net/gtkpod/?rev=1652&view=rev
Author: nicholas
Date: 2007-07-16 14:53:13 -0700 (Mon, 16 Jul 2007)
Log Message:
-----------
photo_python_3.diff from John Carr
Modified Paths:
--------------
libgpod/branches/bug-1723660/bindings/python/ipod.py
libgpod/branches/bug-1723660/bindings/python/tests/tests.py
Modified: libgpod/branches/bug-1723660/bindings/python/ipod.py
===================================================================
--- libgpod/branches/bug-1723660/bindings/python/ipod.py 2007-07-16
16:50:19 UTC (rev 1651)
+++ libgpod/branches/bug-1723660/bindings/python/ipod.py 2007-07-16
21:53:13 UTC (rev 1652)
@@ -850,6 +850,13 @@
else:
self._pa = gpod.itdb_photodb_photoalbum_create(self._db._itdb,
title, pos)
+ def add(self, photo):
+ """Add photo to photo album."""
+ gpod.itdb_photodb_photoalbum_add_photo(self._db._itdb, self._pa,
photo._photo, -1)
+
+ def remove(self, photo):
+ gpod.itdb_photodb_remove_photo(self._db._itdb, self._pa, photo._photo)
+
def get_name(self):
"""Get the name of the photo album."""
return self._pa.name
Modified: libgpod/branches/bug-1723660/bindings/python/tests/tests.py
===================================================================
--- libgpod/branches/bug-1723660/bindings/python/tests/tests.py 2007-07-16
16:50:19 UTC (rev 1651)
+++ libgpod/branches/bug-1723660/bindings/python/tests/tests.py 2007-07-16
21:53:13 UTC (rev 1652)
@@ -127,6 +127,25 @@
t = self.db.new_Photo(filename=photoname)
self.assertEqual(len(self.db), n)
+ def testAddPhotoToAlbum(self):
+ self.testAddPhoto()
+ pa = self.db.new_PhotoAlbum(title="Add To Album Test")
+ count = len(pa)
+ for p in self.db.PhotoAlbums[0]:
+ pa.add(p)
+ self.assertEqual(len(pa), len(self.db.PhotoAlbums[0]))
+ self.failUnless(len(pa) > count)
+
+ def testRemovePhotoFromAlbum(self):
+ self.testAddPhotoToAlbum()
+ pa = self.db.PhotoAlbums[1]
+ for p in pa[:]:
+ pa.remove(p)
+ # make sure we didn't delete the photo
+ self.failUnless(len(self.db.PhotoAlbums[0]) > 0)
+ # but that we did remove them from album
+ self.assertEqual(len(pa), 0)
+
def testAddRemovePhoto(self):
self.testAddPhoto()
self.failUnless(len(self.db) > 0)
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2