~ubuntu-branches/ubuntu/saucy/f-spot/saucy

« back to all changes in this revision

Viewing changes to tests/src/PhotoStore.cs

  • Committer: Bazaar Package Importer
  • Author(s): Iain Lane
  • Date: 2010-05-24 10:35:57 UTC
  • mfrom: (2.4.7 experimental)
  • Revision ID: james.westby@ubuntu.com-20100524103557-1j0i8f66caybci2n
Tags: 0.7.0-1
* New upstream release 0.7.0
 + First release of the unstable 0.7 development series. Massive changes.
 + Reparenting and detaching support (Anton Keks) (Closes: #559745)
 + A new Mallard-based documentation (Harold Schreckengost)
 + No longer embeds flickrnet, uses distribution copy (Iain Lane)
 + Adoption of a large amount of Hyena functionality (Paul Lange, Peter
   Goetz)
 + No longer embeds gnome-keyring-sharp
 + Completely rewritten import, much faster and less memory hungry (Ruben
   Vermeersch) (Closes: #559080, #492658, #341790, #357811, #426017) (LP:
   #412091)
 + No longer use gphoto2-sharp, now uses gvfs which is less crash-pron
   (Ruben Vermeersch)
 + Fix Facebook support (Ruben Vermeersch)
 + Modernized unit tests
 + Revamped build (Mike Gemünde)
 + Much improved duplicate detection (much faster too) (Ruben Vermeersch)
 + Mouse selection in Iconview (Vincent Pomey)
 + Image panning support using middle mouse button (Wojciech Dzierżanowski)
 + Timeline slider now restricted to the size of the window (Iain Churcher)
 + Over 100 bugs closed (http://bit.ly/cyVjnD)
   - No more warnings about schema defaults (Closes: #584215) (LP: #586132)
* debian/control: Clean up build deps to match configure checks
* debian/rules: Don't run dh_makeshilbs as we don't ship any shared
  libraries. There are some private ones though, which get picked up and
  result in a useless postinst/postrm call to ldconfig. Thanks, lintian.
* debian/patches/debian_fix-distclean.patch,
  debian/patches/debian_fix_f-spot.exe.config.patch,
  debian/patches/debian_link-system-flickrnet.patch,
  debian/patches/debian_link-system-gnome-keyring.patch,
  debian/patches/debian_disable-unit-tests,
  debian/patches/git_transition_duration.patch,
  debian/patches/ubuntu_fix_folder_export_hang.patch:
  Clean up obsolete patches which are no longer necessary 
* debian/patches/*: Temporarily disable patches which originated from Ubuntu
  and no longer apply cleanly. We will get these back in a future upstream
  development release.
* debian/patches/*: Refresh to apply cleanly 
* debian/rules: Add new include dir to autoreconf call to pick up f-spot
  macros 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#if ENABLE_NUNIT
2
 
using FSpot.Utils;
3
 
using NUnit.Framework;
4
 
using System.Collections;
5
 
using System.IO;
6
 
using System;
7
 
using Gdk;
8
 
 
9
 
namespace FSpot.Tests
10
 
{
11
 
        [TestFixture]
12
 
        public class PhotoStoreTests
13
 
        {
14
 
                Db db;
15
 
                const string path = "./PhotoStoreTest.db";
16
 
 
17
 
                string [] images = {
18
 
                        "pano.jpg",
19
 
                };
20
 
 
21
 
                [SetUp]
22
 
                public void SetUp ()
23
 
                {
24
 
                        Gtk.Application.Init ();
25
 
                        try {
26
 
                                File.Delete (path);
27
 
                        } catch {}
28
 
 
29
 
                        db = new Db ();
30
 
                        db.Init (path, true);
31
 
 
32
 
                        foreach (string image in images) {
33
 
                                File.Copy ("../images/" + image, "./" + image, true);
34
 
                        }
35
 
 
36
 
                }
37
 
 
38
 
                [TearDown]
39
 
                public void TearDown ()
40
 
                {
41
 
                        db.Dispose ();
42
 
                        foreach (string image in images)
43
 
                                try {
44
 
                                        File.Delete ("./" + image);
45
 
                                } catch {}
46
 
                }
47
 
 
48
 
//      static void Dump (Photo photo)
49
 
//      {
50
 
//      //      Console.WriteLine ("\t[{0}] {1}", photo.Id, photo.Path);
51
 
//              Console.WriteLine ("\t{0}", photo.Time.ToLocalTime ());
52
 
//
53
 
//              if (photo.Description != String.Empty)
54
 
//                      Console.WriteLine ("\t{0}", photo.Description);
55
 
//              else
56
 
//                      Console.WriteLine ("\t(no description)");
57
 
//
58
 
//              Console.WriteLine ("\tTags:");
59
 
//
60
 
//              if (photo.Tags.Count == 0) {
61
 
//                      Console.WriteLine ("\t\t(no tags)");
62
 
//              } else {
63
 
//                      foreach (Tag t in photo.Tags)
64
 
//                              Console.WriteLine ("\t\t{0}", t.Name);
65
 
//              }
66
 
//
67
 
//              Console.WriteLine ("\tVersions:");
68
 
//
69
 
//              foreach (uint id in photo.VersionIds)
70
 
//                      Console.WriteLine ("\t\t[{0}] {1}", id, photo.GetVersionName (id));
71
 
//      }
72
 
 
73
 
//      static void Dump (ArrayList photos)
74
 
//      {
75
 
//              foreach (Photo p in photos)
76
 
//                      Dump (p);
77
 
//      }
78
 
//
79
 
//      static void DumpAll (Db db)
80
 
//      {
81
 
//              Console.WriteLine ("\n*** All pictures");
82
 
//              Dump (db.Photos.Query (null));
83
 
//      }
84
 
//
85
 
//      static void DumpForTags (Db db, ArrayList tags)
86
 
//      {
87
 
//              Console.Write ("\n*** Pictures for tags: ");
88
 
//              foreach (Tag t in tags)
89
 
//                      Console.Write ("{0} ", t.Name);
90
 
//              Console.WriteLine ();
91
 
//
92
 
//              Dump (db.Photos.Query (tags));
93
 
//      }
94
 
 
95
 
                [Test]
96
 
                public void PopulatendRetrieve ()
97
 
                {
98
 
                        /*Tag portraits_tag = */db.Tags.CreateTag (null, "Portraits", false);
99
 
                        Tag landscapes_tag = db.Tags.CreateTag (null, "Landscapes", false);
100
 
                        Tag favorites_tag = db.Tags.CreateTag (null, "Street", false);
101
 
        
102
 
                        //uint portraits_tag_id = portraits_tag.Id;
103
 
                        //uint landscapes_tag_id = landscapes_tag.Id;
104
 
                        //uint favorites_tag_id = favorites_tag.Id;
105
 
        
106
 
                        Pixbuf unused_thumbnail;
107
 
        
108
 
                        Photo ny_landscape = db.Photos.Create (UriUtils.PathToFileUri ("../images/pano.jpg"), 0, out unused_thumbnail);
109
 
                        ny_landscape.Description = "Snowy landscape";
110
 
                        ny_landscape.AddTag (landscapes_tag);
111
 
                        ny_landscape.AddTag (favorites_tag);
112
 
                        db.Photos.Commit (ny_landscape);
113
 
        
114
 
//                      Photo me_in_sf = db.Photos.Create (DateTime.Now.ToUniversalTime (), 2, "/home/ettore/Photos/me_in_sf.jpg",
115
 
//                                                         out unused_thumbnail);
116
 
//                      me_in_sf.AddTag (landscapes_tag);
117
 
//                      me_in_sf.AddTag (portraits_tag);
118
 
//                      me_in_sf.AddTag (favorites_tag);
119
 
//                      db.Photos.Commit (me_in_sf);
120
 
//      
121
 
//                      me_in_sf.RemoveTag (favorites_tag);
122
 
//                      me_in_sf.Description = "Myself and the SF skyline";
123
 
//                      me_in_sf.CreateVersion ("cropped", Photo.OriginalVersionId);
124
 
//                      me_in_sf.CreateVersion ("UM-ed", Photo.OriginalVersionId);
125
 
//                      db.Photos.Commit (me_in_sf);
126
 
//      
127
 
//                      Photo macro_shot = db.Photos.Create (DateTime.Now.ToUniversalTime (), 2, "/home/ettore/Photos/macro_shot.jpg",
128
 
//                                                           out unused_thumbnail);
129
 
                        db.Dispose ();
130
 
        
131
 
                        db.Init (path, false);
132
 
        
133
 
//                      DumpAll (db);
134
 
//      
135
 
//                      portraits_tag = db.Tags.Get (portraits_tag_id) as Tag;
136
 
//                      landscapes_tag = db.Tags.Get (landscapes_tag_id) as Tag;
137
 
//                      favorites_tag = db.Tags.Get (favorites_tag_id) as Tag;
138
 
//      
139
 
//                      ArrayList query_tags = new ArrayList ();
140
 
//                      query_tags.Add (portraits_tag);
141
 
//                      query_tags.Add (landscapes_tag);
142
 
//                      DumpForTags (db, query_tags);
143
 
//      
144
 
//                      query_tags.Clear ();
145
 
//                      query_tags.Add (favorites_tag);
146
 
//                      DumpForTags (db, query_tags);
147
 
                }
148
 
        }
149
 
}
150
 
#endif
151