banshee r5135 - in trunk/banshee: . src/Core/Banshee.Core src/Core/Banshee.Core/Banshee.Base/Tests



Author: jmillikin
Date: Sun Mar 15 01:55:32 2009
New Revision: 5135
URL: http://svn.gnome.org/viewvc/banshee?rev=5135&view=rev

Log:
2009-03-14  John Millikin  <jmillikin gmail com>

	* src/Core/Banshee.Core/Makefile.am:
	* src/Core/Banshee.Core/Banshee.Base/Tests/CoverArtSpecTests.cs:
	Add tests for escaping cover art filename fragments.



Added:
   trunk/banshee/src/Core/Banshee.Core/Banshee.Base/Tests/CoverArtSpecTests.cs
Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Core/Banshee.Core/Makefile.am

Added: trunk/banshee/src/Core/Banshee.Core/Banshee.Base/Tests/CoverArtSpecTests.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Core/Banshee.Core/Banshee.Base/Tests/CoverArtSpecTests.cs	Sun Mar 15 01:55:32 2009
@@ -0,0 +1,94 @@
+//
+// CoverArtSpecTests.cs
+//
+// Author:
+//   John Millikin <jmillikin gmail com>
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if ENABLE_TESTS
+
+using System;
+using NUnit.Framework;
+
+using Banshee.Base;
+
+namespace Banshee.Base.Tests
+{
+    [TestFixture]
+    public class EscapePartTests
+    {
+        private void AssertEscaped (string original, string expected)
+        {
+            Assert.AreEqual (expected, CoverArtSpec.EscapePart (original));
+        }
+        
+        [Test]
+        public void TestEmpty ()
+        {
+            AssertEscaped (null, null);
+            AssertEscaped ("", null);
+        }
+        
+        [Test]
+        public void TestLowercased ()
+        {
+            AssertEscaped ("A", "a");
+        }
+        
+        [Test]
+        public void TestUnwanted ()
+        {
+            // Part of the in-progress media art storage spec
+            AssertEscaped ("!", "");
+            AssertEscaped ("@", "");
+            AssertEscaped ("#", "");
+            AssertEscaped ("$", "");
+            AssertEscaped ("^", "");
+            AssertEscaped ("&", "");
+            AssertEscaped ("*", "");
+            AssertEscaped ("_", "");
+            AssertEscaped ("+", "");
+            AssertEscaped ("=", "");
+            AssertEscaped ("|", "");
+            AssertEscaped ("\\", "");
+            AssertEscaped ("/", "");
+            AssertEscaped ("?", "");
+            AssertEscaped ("~", "");
+            AssertEscaped ("`", "");
+            AssertEscaped ("'", "");
+            AssertEscaped ("\"", "");
+            
+            // Banshee-specific: strip *everything* non-ASCII
+            AssertEscaped ("\u00e9toile", "toile");
+            AssertEscaped ("e\u0301", "e");
+        }
+        
+        [Test]
+        public void TestStripNotes ()
+        {
+            AssertEscaped ("a(b)cd", "a");
+            AssertEscaped ("a(b)c(d)e", "abc");
+        }
+    }
+}
+
+#endif

Modified: trunk/banshee/src/Core/Banshee.Core/Makefile.am
==============================================================================
--- trunk/banshee/src/Core/Banshee.Core/Makefile.am	(original)
+++ trunk/banshee/src/Core/Banshee.Core/Makefile.am	Sun Mar 15 01:55:32 2009
@@ -14,6 +14,7 @@
 	Banshee.Base/SafeUri.cs \
 	Banshee.Base/Tests/FileNamePatternTests.cs \
 	Banshee.Base/Tests/TaglibReadWriteTests.cs \
+	Banshee.Base/Tests/CoverArtSpecTests.cs \
 	Banshee.Base/UriList.cs \
 	Banshee.Base/XdgBaseDirectorySpec.cs \
 	Banshee.Collection/AlbumInfo.cs \
@@ -74,4 +75,4 @@
 include $(top_srcdir)/build/build.mk
 
 EXTRA_DIST += Banshee.Core.dll.config
-module_SCRIPTS += Banshee.Core.dll.config
\ No newline at end of file
+module_SCRIPTS += Banshee.Core.dll.config



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]