f-spot r4691 - in trunk: Tests/src Tests/src/Filters src src/Filters
- From: sdelcroix svn gnome org
- To: svn-commits-list gnome org
- Subject: f-spot r4691 - in trunk: Tests/src Tests/src/Filters src src/Filters
- Date: Wed, 7 Jan 2009 15:10:07 +0000 (UTC)
Author: sdelcroix
Date: Wed Jan 7 15:10:07 2009
New Revision: 4691
URL: http://svn.gnome.org/viewvc/f-spot?rev=4691&view=rev
Log:
move some tests to Tests
Added:
trunk/Tests/src/Filters/
trunk/Tests/src/Filters/ColorFilter.cs
trunk/Tests/src/Filters/JpegFilter.cs
trunk/Tests/src/Filters/OrientationFilter.cs
Modified:
trunk/Tests/src/Makefile
trunk/src/Filters/ColorFilter.cs
trunk/src/Filters/JpegFilter.cs
trunk/src/Filters/OrientationFilter.cs
trunk/src/Makefile.am
Added: trunk/Tests/src/Filters/ColorFilter.cs
==============================================================================
--- (empty file)
+++ trunk/Tests/src/Filters/ColorFilter.cs Wed Jan 7 15:10:07 2009
@@ -0,0 +1,48 @@
+#if ENABLE_NUNIT
+using NUnit.Framework;
+#endif
+
+#if ENABLE_NUNIT
+ [TestFixture]
+ public class Tests : ImageTest
+ {
+ [Test]
+ public void GoGoGadgetStretch ()
+ {
+ Process ("autostretch.png");
+ }
+
+#if false
+ [Test]
+ public void StretchRealFile ()
+ {
+ string path = "/home/lewing/Desktop/img_0081.jpg";
+ FilterRequest req = new FilterRequest (path);
+ FilterSet set = new FilterSet ();
+ set.Add (new AutoStretchFilter ());
+ set.Add (new UniqueNameFilter (Path.GetDirectoryName (path)));
+ set.Convert (req);
+ req.Preserve (req.Current);
+ }
+#endif
+
+ public void Process (string name)
+ {
+ string path = CreateFile (name, 120);
+ using (FilterRequest req = new FilterRequest (path)) {
+ IFilter filter = new AutoStretchFilter ();
+ Assert.IsTrue (filter.Convert (req), "Filter failed to operate");
+ Assert.IsTrue (System.IO.File.Exists (req.Current.LocalPath),
+ "Error: Did not create " + req.Current.LocalPath);
+ Assert.IsTrue (new FileInfo (req.Current.LocalPath).Length > 0,
+ "Error: " + req.Current.LocalPath + "is Zero length");
+ //req.Preserve (req.Current);
+ using (ImageFile img = ImageFile.Create (req.Current)) {
+ Pixbuf pixbuf = img.Load ();
+ Assert.IsNotNull (pixbuf);
+ }
+ }
+ }
+ }
+#endif
+
Added: trunk/Tests/src/Filters/JpegFilter.cs
==============================================================================
--- (empty file)
+++ trunk/Tests/src/Filters/JpegFilter.cs Wed Jan 7 15:10:07 2009
@@ -0,0 +1,74 @@
+#if ENABLE_NUNIT
+using NUnit.Framework;
+#endif
+
+#if ENABLE_NUNIT
+ [TestFixture]
+ public class Tests : ImageTest
+ {
+ string [] Names = {
+ "fspot-jpegfilter-test.png",
+ "fspot-jpegfilter-test.jpeg",
+ "fspot-jpegfilter-test.jpg",
+ "fspot-jpegfilter-test.JPG",
+ };
+
+ [Test]
+ public void ResultIsJpeg ()
+ {
+ foreach (string name in Names)
+ ResultIsJpeg (name);
+ }
+
+ public void ResultIsJpeg (string name)
+ {
+ string path = CreateFile (name, 48);
+ IFilter filter = new JpegFilter ();
+ FilterRequest req = new FilterRequest (path);
+ filter.Convert (req);
+ using (ImageFile img = new JpegFile (req.Current)) {
+ Assert.IsTrue (img != null, "result is null");
+ Assert.IsTrue (img is JpegFile, "result is not a jpg");
+ }
+ System.IO.File.Delete (path);
+ }
+
+ [Test]
+ public void ExtensionIsJPG ()
+ {
+ foreach (string name in Names)
+ ExtensionIsJPG (name);
+ }
+
+ public void ExtensionIsJPG (string name)
+ {
+ string path = CreateFile (name, 48);
+ IFilter filter = new JpegFilter ();
+ FilterRequest req = new FilterRequest (path);
+ filter.Convert (req);
+ string extension = System.IO.Path.GetExtension (req.Current.LocalPath).ToLower ();
+ Assert.IsTrue (extension == ".jpg" || extension == ".jpeg", String.Format ("{0} is not a valid extension for Jpeg", extension));
+ System.IO.File.Delete (path);
+ }
+
+ [Test]
+ public void OriginalUntouched ()
+ {
+ foreach (string name in Names)
+ OriginalUntouched (name);
+ }
+
+ public void OriginalUntouched (string name)
+ {
+ string path = CreateFile (name, 48);
+ IFilter filter = new JpegFilter ();
+ FilterRequest req = new FilterRequest (path);
+ long original_size = new System.IO.FileInfo (path).Length;
+ filter.Convert (req);
+ long final_size = new System.IO.FileInfo (req.Source.LocalPath).Length;
+ Assert.IsTrue (original_size == final_size, "original is modified !!!");
+ System.IO.File.Delete (path);
+ }
+ }
+#endif
+
Added: trunk/Tests/src/Filters/OrientationFilter.cs
==============================================================================
--- (empty file)
+++ trunk/Tests/src/Filters/OrientationFilter.cs Wed Jan 7 15:10:07 2009
@@ -0,0 +1,17 @@
+#if ENABLE_NUNIT
+using NUnit.Framework;
+#endif
+#if ENABLE_NUNIT
+ [TestFixture]
+ public class Tests : ImageTest {
+ [Test]
+ public void TestNoop ()
+ {
+ string path = CreateFile ("test.jpg", 50);
+ FilterRequest req = new FilterRequest (path);
+ IFilter filter = new OrientationFilter ();
+ Assert.IsFalse (filter.Convert (req), "Orientation Filter changed a normal file");
+ }
+ }
+#endif
+
Modified: trunk/Tests/src/Makefile
==============================================================================
--- trunk/Tests/src/Makefile (original)
+++ trunk/Tests/src/Makefile Wed Jan 7 15:10:07 2009
@@ -9,7 +9,10 @@
TagStore.cs \
ThumbnailGenerator.cs \
Query/LogicalTerm.cs \
- Cms/Cms.cs
+ Cms/Cms.cs \
+ Filters/JpegFilter.cs \
+ Filters/OrientationFilter.cs \
+ Filters/ColorFilter.cs
PKGS = \
-pkg:mono-nunit \
Modified: trunk/src/Filters/ColorFilter.cs
==============================================================================
--- trunk/src/Filters/ColorFilter.cs (original)
+++ trunk/src/Filters/ColorFilter.cs Wed Jan 7 15:10:07 2009
@@ -17,10 +17,6 @@
using FSpot.Utils;
using FSpot.ColorAdjustment;
-#if ENABLE_NUNIT
-using NUnit.Framework;
-#endif
-
namespace FSpot.Filters {
public abstract class ColorFilter : IFilter {
public bool Convert (FilterRequest req)
@@ -51,49 +47,5 @@
protected override Adjustment CreateAdjustment (Pixbuf input, Cms.Profile input_profile) {
return new FSpot.ColorAdjustment.AutoStretch (input, input_profile);
}
-
-#if ENABLE_NUNIT
- [TestFixture]
- public class Tests : ImageTest
- {
- [Test]
- public void GoGoGadgetStretch ()
- {
- Process ("autostretch.png");
- }
-
-#if false
- [Test]
- public void StretchRealFile ()
- {
- string path = "/home/lewing/Desktop/img_0081.jpg";
- FilterRequest req = new FilterRequest (path);
- FilterSet set = new FilterSet ();
- set.Add (new AutoStretchFilter ());
- set.Add (new UniqueNameFilter (Path.GetDirectoryName (path)));
- set.Convert (req);
- req.Preserve (req.Current);
- }
-#endif
-
- public void Process (string name)
- {
- string path = CreateFile (name, 120);
- using (FilterRequest req = new FilterRequest (path)) {
- IFilter filter = new AutoStretchFilter ();
- Assert.IsTrue (filter.Convert (req), "Filter failed to operate");
- Assert.IsTrue (System.IO.File.Exists (req.Current.LocalPath),
- "Error: Did not create " + req.Current.LocalPath);
- Assert.IsTrue (new FileInfo (req.Current.LocalPath).Length > 0,
- "Error: " + req.Current.LocalPath + "is Zero length");
- //req.Preserve (req.Current);
- using (ImageFile img = ImageFile.Create (req.Current)) {
- Pixbuf pixbuf = img.Load ();
- Assert.IsNotNull (pixbuf);
- }
- }
- }
- }
-#endif
}
}
Modified: trunk/src/Filters/JpegFilter.cs
==============================================================================
--- trunk/src/Filters/JpegFilter.cs (original)
+++ trunk/src/Filters/JpegFilter.cs Wed Jan 7 15:10:07 2009
@@ -9,10 +9,6 @@
*/
using System;
-#if ENABLE_NUNIT
-using NUnit.Framework;
-#endif
-
namespace FSpot.Filters {
public class JpegFilter : IFilter {
private uint quality = 95;
@@ -55,74 +51,5 @@
return true;
}
-#if ENABLE_NUNIT
- [TestFixture]
- public class Tests : ImageTest
- {
- string [] Names = {
- "fspot-jpegfilter-test.png",
- "fspot-jpegfilter-test.jpeg",
- "fspot-jpegfilter-test.jpg",
- "fspot-jpegfilter-test.JPG",
- };
-
- [Test]
- public void ResultIsJpeg ()
- {
- foreach (string name in Names)
- ResultIsJpeg (name);
- }
-
- public void ResultIsJpeg (string name)
- {
- string path = CreateFile (name, 48);
- IFilter filter = new JpegFilter ();
- FilterRequest req = new FilterRequest (path);
- filter.Convert (req);
- using (ImageFile img = new JpegFile (req.Current)) {
- Assert.IsTrue (img != null, "result is null");
- Assert.IsTrue (img is JpegFile, "result is not a jpg");
- }
- System.IO.File.Delete (path);
- }
-
- [Test]
- public void ExtensionIsJPG ()
- {
- foreach (string name in Names)
- ExtensionIsJPG (name);
- }
-
- public void ExtensionIsJPG (string name)
- {
- string path = CreateFile (name, 48);
- IFilter filter = new JpegFilter ();
- FilterRequest req = new FilterRequest (path);
- filter.Convert (req);
- string extension = System.IO.Path.GetExtension (req.Current.LocalPath).ToLower ();
- Assert.IsTrue (extension == ".jpg" || extension == ".jpeg", String.Format ("{0} is not a valid extension for Jpeg", extension));
- System.IO.File.Delete (path);
- }
-
- [Test]
- public void OriginalUntouched ()
- {
- foreach (string name in Names)
- OriginalUntouched (name);
- }
-
- public void OriginalUntouched (string name)
- {
- string path = CreateFile (name, 48);
- IFilter filter = new JpegFilter ();
- FilterRequest req = new FilterRequest (path);
- long original_size = new System.IO.FileInfo (path).Length;
- filter.Convert (req);
- long final_size = new System.IO.FileInfo (req.Source.LocalPath).Length;
- Assert.IsTrue (original_size == final_size, "original is modified !!!");
- System.IO.File.Delete (path);
- }
- }
-#endif
}
}
Modified: trunk/src/Filters/OrientationFilter.cs
==============================================================================
--- trunk/src/Filters/OrientationFilter.cs (original)
+++ trunk/src/Filters/OrientationFilter.cs Wed Jan 7 15:10:07 2009
@@ -8,9 +8,6 @@
* This is free software, see COPYING fro details
*
*/
-#if ENABLE_NUNIT
-using NUnit.Framework;
-#endif
namespace FSpot.Filters {
public class OrientationFilter : IFilter {
@@ -67,18 +64,5 @@
}
}
-#if ENABLE_NUNIT
- [TestFixture]
- public class Tests : ImageTest {
- [Test]
- public void TestNoop ()
- {
- string path = CreateFile ("test.jpg", 50);
- FilterRequest req = new FilterRequest (path);
- IFilter filter = new OrientationFilter ();
- Assert.IsFalse (filter.Convert (req), "Orientation Filter changed a normal file");
- }
- }
-#endif
}
}
Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Wed Jan 7 15:10:07 2009
@@ -159,7 +159,6 @@
$(srcdir)/Accelerometer.cs \
$(srcdir)/Histogram.cs \
$(srcdir)/ImageView.cs \
- $(srcdir)/ImageTest.cs \
$(srcdir)/ImportBackend.cs \
$(srcdir)/ImportCommand.cs \
$(srcdir)/InfoOverlay.cs \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]