banshee r3869 - in trunk/banshee: . build src/Core/Banshee.Core/Banshee.Base src/Core/Banshee.Core/Banshee.Configuration src/Core/Banshee.Services src/Core/Banshee.Services/Banshee.Library src/Core/Banshee.Services/Banshee.ServiceStack src/Core/Banshee.Services/Banshee.SmartPlaylist src/Core/Banshee.Services/Banshee.Sources src/Core/Banshee.ThickClient/Banshee.SmartPlaylist.Gui src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio src/Libraries/Hyena/Hyena.CommandLine tests tests/Banshee.Core tests/Banshee.Services tests/Banshee.ThickClient tests/Hyena
- From: gburt svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r3869 - in trunk/banshee: . build src/Core/Banshee.Core/Banshee.Base src/Core/Banshee.Core/Banshee.Configuration src/Core/Banshee.Services src/Core/Banshee.Services/Banshee.Library src/Core/Banshee.Services/Banshee.ServiceStack src/Core/Banshee.Services/Banshee.SmartPlaylist src/Core/Banshee.Services/Banshee.Sources src/Core/Banshee.ThickClient/Banshee.SmartPlaylist.Gui src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio src/Libraries/Hyena/Hyena.CommandLine tests tests/Banshee.Core tests/Banshee.Services tests/Banshee.ThickClient tests/Hyena
- Date: Sat, 3 May 2008 01:33:37 +0100 (BST)
Author: gburt
Date: Sat May 3 00:33:37 2008
New Revision: 3869
URL: http://svn.gnome.org/viewvc/banshee?rev=3869&view=rev
Log:
2008-05-02 Gabriel Burt <gabriel burt gmail com>
* src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/LastfmActions.cs: Set
Love/Hate as Important so text shows up; accidentally removed.
* src/Core/Banshee.ThickClient/Banshee.SmartPlaylist.Gui/Editor.cs: Get
the list of predefined smart playlists from the PrimarySource. Show the
SmartPlaylistDescription to make a prettier, more informative TreeView of
predefined options.
* src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs: Add
Default/NonDefault/PredefinedSmartPlaylist properties.
* src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs: Remove
unnecessary ConfigurationClient.Initialize ().
* src/Core/Banshee.Services/Banshee.Library/MusicLibrarySource.cs:
Override the SmartPlaylist properties.
* src/Core/Banshee.Services/Makefile.am:
* src/Core/Banshee.Services/Banshee.SmartPlaylist/SmartPlaylistDefinition.cs:
New struct that holds the definition of a smart playlist (and a
description), and that has a method for producing a SmartPlaylistSource
from itself.
* src/Core/Banshee.Core/Banshee.Configuration/ConfigurationClient.cs: Do
not require Initialization call, instead do it implicitly/lazily.
* src/Core/Banshee.Core/Banshee.Base/Paths.cs: Use GetExecutingAsembly
intead of GetEntryAssembly in attempt to get Nereid-within-unit-test
working.
* src/Libraries/Hyena/Hyena.CommandLine/CommandLineParser.cs: Allow
programatically setting a command line option's value.
* build/build.environment.mk: Add LINK/DEPS vars for Nereid so unit tests
can link against it.
* tests/Hyena/RangeCollectionTests.cs:
* tests/Hyena/DbBoundType.cs:
* tests/Hyena/SqliteModelProviderTests.cs:
* tests/Hyena/CryptoUtilTests.cs:
* tests/Hyena/SqliteCommandTests.cs:
* tests/Hyena/StringUtilTests.cs:
* tests/Banshee.Services/PlaylistFormatTests.cs:
* tests/Banshee.Core/FileNamePatternTests.cs:
* tests/Banshee.Core/KernelTests.cs:
* tests/Hyena/SelectionTests.cs: Add copyright information.
* tests/Hyena/QueryTests.cs: Subclass from BansheeTests, and move the
AssertForEach to it.
* tests/Hyena/BansheeTests.cs: New abstract class that provides
AssertForEach method, and some new methods for progamatically starting
Banshee (currently unused, not working).
* tests/Banshee.ThickClient/GuiTests.cs: New class for testing starting
banshee from unit test. Currently commented out.
* tests/Banshee.Services/SmartPlaylistTests.cs: New tests to ensure all
predefined smart playlists can be created successfully. Currently
commented out.
* tests/Makefile.am: Add new test classes.
* tests/Banshee.Core/TaglibReadWriteTests.cs: Subclass from BansheeTests
and move some static initialization there.
Added:
trunk/banshee/src/Core/Banshee.Services/Banshee.SmartPlaylist/SmartPlaylistDefinition.cs
trunk/banshee/tests/Banshee.Services/SmartPlaylistTests.cs
trunk/banshee/tests/Banshee.ThickClient/
trunk/banshee/tests/Banshee.ThickClient/GuiTests.cs
trunk/banshee/tests/BansheeTests.cs
Modified:
trunk/banshee/ChangeLog
trunk/banshee/build/build.environment.mk
trunk/banshee/src/Core/Banshee.Core/Banshee.Base/Paths.cs
trunk/banshee/src/Core/Banshee.Core/Banshee.Configuration/ConfigurationClient.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Library/MusicLibrarySource.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs
trunk/banshee/src/Core/Banshee.Services/Makefile.am
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.SmartPlaylist.Gui/Editor.cs
trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/LastfmActions.cs
trunk/banshee/src/Libraries/Hyena/Hyena.CommandLine/CommandLineParser.cs
trunk/banshee/tests/Banshee.Core/FileNamePatternTests.cs
trunk/banshee/tests/Banshee.Core/KernelTests.cs
trunk/banshee/tests/Banshee.Core/TaglibReadWriteTests.cs
trunk/banshee/tests/Banshee.Services/PlaylistFormatTests.cs
trunk/banshee/tests/Hyena/CryptoUtilTests.cs
trunk/banshee/tests/Hyena/DbBoundType.cs
trunk/banshee/tests/Hyena/QueryTests.cs
trunk/banshee/tests/Hyena/RangeCollectionTests.cs
trunk/banshee/tests/Hyena/SelectionTests.cs
trunk/banshee/tests/Hyena/SqliteCommandTests.cs
trunk/banshee/tests/Hyena/SqliteModelProviderTests.cs
trunk/banshee/tests/Hyena/StringUtilTests.cs
trunk/banshee/tests/Makefile.am
Modified: trunk/banshee/build/build.environment.mk
==============================================================================
--- trunk/banshee/build/build.environment.mk (original)
+++ trunk/banshee/build/build.environment.mk Sat May 3 00:33:37 2008
@@ -90,6 +90,8 @@
$(LINK_BANSHEE_THICKCLIENT)
REF_NEREID = $(LINK_BANSHEE_THICKCLIENT_DEPS)
+LINK_NEREID = -r:$(DIR_BIN)/Nereid.exe
+LINK_NEREID_DEPS = $(REF_NEREID) $(LINK_NEREID)
# Dap
REF_DAP = $(LINK_BANSHEE_SERVICES_DEPS) $(LINK_BANSHEE_THICKCLIENT_DEPS)
Modified: trunk/banshee/src/Core/Banshee.Core/Banshee.Base/Paths.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Core/Banshee.Base/Paths.cs (original)
+++ trunk/banshee/src/Core/Banshee.Core/Banshee.Base/Paths.cs Sat May 3 00:33:37 2008
@@ -170,7 +170,7 @@
get {
if (installed_application_prefix == null) {
installed_application_prefix = Path.GetDirectoryName (
- System.Reflection.Assembly.GetEntryAssembly ().Location);
+ System.Reflection.Assembly.GetExecutingAssembly ().Location);
if (Directory.Exists (Paths.Combine (installed_application_prefix, "share", "banshee-1"))) {
return installed_application_prefix;
Modified: trunk/banshee/src/Core/Banshee.Core/Banshee.Configuration/ConfigurationClient.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Core/Banshee.Configuration/ConfigurationClient.cs (original)
+++ trunk/banshee/src/Core/Banshee.Core/Banshee.Configuration/ConfigurationClient.cs Sat May 3 00:33:37 2008
@@ -38,7 +38,7 @@
{
private static IConfigurationClient client;
- public static void Initialize ()
+ private static void Initialize ()
{
lock (typeof (ConfigurationClient)) {
if (client != null) {
@@ -64,40 +64,49 @@
Log.DebugFormat ("Configuration client extension loaded ({0})", client.GetType ().FullName);
}
}
+
+ public static IConfigurationClient Client {
+ get {
+ if (client == null) {
+ Initialize ();
+ }
+ return client;
+ }
+ }
public static T Get<T> (SchemaEntry<T> entry)
{
- return client.Get<T> (entry);
+ return Client.Get<T> (entry);
}
public static T Get<T> (SchemaEntry<T> entry, T fallback)
{
- return client.Get<T> (entry, fallback);
+ return Client.Get<T> (entry, fallback);
}
public static T Get<T> (string key, T fallback)
{
- return client.Get<T> (key, fallback);
+ return Client.Get<T> (key, fallback);
}
public static T Get<T> (string @namespace, string key, T fallback)
{
- return client.Get<T> (@namespace, key, fallback);
+ return Client.Get<T> (@namespace, key, fallback);
}
public static void Set<T> (SchemaEntry<T> entry, T value)
{
- client.Set<T> (entry, value);
+ Client.Set<T> (entry, value);
}
public static void Set<T> (string key, T value)
{
- client.Set<T> (key, value);
+ Client.Set<T> (key, value);
}
public static void Set<T> (string @namespace, string key, T value)
{
- client.Set<T> (@namespace, key, value);
+ Client.Set<T> (@namespace, key, value);
}
}
}
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Library/MusicLibrarySource.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Library/MusicLibrarySource.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Library/MusicLibrarySource.cs Sat May 3 00:33:37 2008
@@ -28,8 +28,12 @@
//
using System;
+using System.Collections.Generic;
+
using Mono.Unix;
+using Banshee.SmartPlaylist;
+
namespace Banshee.Library
{
public class MusicLibrarySource : LibrarySource
@@ -38,5 +42,59 @@
{
Properties.SetStringList ("Icon.Name", "audio-x-generic", "source-library");
}
+
+ public override IEnumerable<SmartPlaylistDefinition> DefaultSmartPlaylists {
+ get { return default_smart_playlists; }
+ }
+
+ public override IEnumerable<SmartPlaylistDefinition> NonDefaultSmartPlaylists {
+ get { return non_default_smart_playlists; }
+ }
+
+ private static SmartPlaylistDefinition [] default_smart_playlists = new SmartPlaylistDefinition [] {
+ new SmartPlaylistDefinition (
+ Catalog.GetString ("Favorites"),
+ Catalog.GetString ("Songs rated four and five stars"),
+ "rating>=4"),
+
+ new SmartPlaylistDefinition (
+ Catalog.GetString ("Recent Favorites"),
+ Catalog.GetString ("Songs listened to often in the past week"),
+ "played<\"1 week ago\" playcount>3"),
+
+ new SmartPlaylistDefinition (
+ Catalog.GetString ("Unrated"),
+ Catalog.GetString ("Songs that haven't been rated"),
+ "rating=0"),
+ };
+
+ private static SmartPlaylistDefinition [] non_default_smart_playlists = new SmartPlaylistDefinition [] {
+ new SmartPlaylistDefinition (
+ Catalog.GetString ("Neglected Favorites"),
+ Catalog.GetString ("Favorites not played in over two weeks"),
+ "rating>3 played>=\"2 weeks ago\""),
+
+ new SmartPlaylistDefinition (
+ Catalog.GetString ("Least Favorite"),
+ Catalog.GetString ("Songs rated one or two stars or that you have frequently skipped"),
+ "rating<3 or skips>4"),
+
+ new SmartPlaylistDefinition (
+ Catalog.GetString ("700 MB of Favorites"),
+ Catalog.GetString ("A data CD worth of favorite songs"),
+ "rating>=4",
+ 700, "MB", "PlayCount-DESC"),
+
+ new SmartPlaylistDefinition (
+ Catalog.GetString ("80 Minutes of Favorites"),
+ Catalog.GetString ("An audio CD worth of favorite songs"),
+ "rating>=4",
+ 80, "minutes", "PlayCount-DESC"),
+
+ new SmartPlaylistDefinition (
+ Catalog.GetString ("Unheard"),
+ Catalog.GetString ("Songs that have not been played"),
+ "playcount=0"),
+ };
}
}
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs Sat May 3 00:33:37 2008
@@ -87,7 +87,6 @@
AddinManager.Registry.Update (monitor);
}
- Banshee.Configuration.ConfigurationClient.Initialize ();
extension_nodes = AddinManager.GetExtensionNodes ("/Banshee/ServiceManager/Service");
Application.ClientStarted += OnClientStarted;
Added: trunk/banshee/src/Core/Banshee.Services/Banshee.SmartPlaylist/SmartPlaylistDefinition.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.SmartPlaylist/SmartPlaylistDefinition.cs Sat May 3 00:33:37 2008
@@ -0,0 +1,80 @@
+//
+// SmartPlaylistDefinition.cs
+//
+// Author:
+// Gabriel Burt <gburt novell com>
+//
+// Copyright (C) 2008 Novell, Inc.
+//
+// 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.
+//
+
+using System;
+
+using Hyena.Query;
+
+using Banshee.Query;
+using Banshee.Sources;
+
+namespace Banshee.SmartPlaylist
+{
+ public struct SmartPlaylistDefinition
+ {
+ public readonly string Name;
+ public readonly string Description;
+ public readonly string Condition;
+ public readonly QueryOrder Order;
+ public readonly QueryLimit Limit;
+ public readonly IntegerQueryValue LimitNumber;
+
+ public SmartPlaylistDefinition (string name, string description, string condition)
+ : this (name, description, condition, 0, (QueryLimit)null, null)
+ {
+ }
+
+ public SmartPlaylistDefinition (string name, string description, string condition,
+ int limit_number, string limit, string order)
+ : this (name, description, condition, limit_number, BansheeQuery.FindLimit (limit), BansheeQuery.FindOrder (order))
+ {
+ }
+
+ public SmartPlaylistDefinition (string name, string description, string condition,
+ int limit_number, QueryLimit limit, QueryOrder order)
+ {
+ Name = name;
+ Description = description;
+ Condition = condition;
+ LimitNumber = new IntegerQueryValue ();
+ LimitNumber.SetValue (limit_number);
+ Limit = limit;
+ Order = order;
+ }
+
+ public SmartPlaylistSource ToSmartPlaylistSource (PrimarySource primary_source)
+ {
+ return new SmartPlaylistSource (
+ Name,
+ UserQueryParser.Parse (Condition, BansheeQuery.FieldSet),
+ Order, Limit, LimitNumber,
+ primary_source.DbId
+ );
+ }
+ }
+}
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs Sat May 3 00:33:37 2008
@@ -235,6 +235,24 @@
}
}
+ public virtual IEnumerable<SmartPlaylistDefinition> DefaultSmartPlaylists {
+ get { yield break; }
+ }
+
+ public virtual IEnumerable<SmartPlaylistDefinition> NonDefaultSmartPlaylists {
+ get { yield break; }
+ }
+
+ public IEnumerable<SmartPlaylistDefinition> PredefinedSmartPlaylists {
+ get {
+ foreach (SmartPlaylistDefinition def in DefaultSmartPlaylists)
+ yield return def;
+
+ foreach (SmartPlaylistDefinition def in NonDefaultSmartPlaylists)
+ yield return def;
+ }
+ }
+
public override bool CanSearch {
get { return true; }
}
Modified: trunk/banshee/src/Core/Banshee.Services/Makefile.am
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Makefile.am (original)
+++ trunk/banshee/src/Core/Banshee.Services/Makefile.am Sat May 3 00:33:37 2008
@@ -139,6 +139,7 @@
Banshee.ServiceStack/UserJobEventHandler.cs \
Banshee.ServiceStack/UserJobManager.cs \
Banshee.SmartPlaylist/Migrator.cs \
+ Banshee.SmartPlaylist/SmartPlaylistDefinition.cs \
Banshee.SmartPlaylist/SmartPlaylistSource.cs \
Banshee.Sources/DatabaseSource.cs \
Banshee.Sources/DurationStatusFormatters.cs \
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.SmartPlaylist.Gui/Editor.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.SmartPlaylist.Gui/Editor.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.SmartPlaylist.Gui/Editor.cs Sat May 3 00:33:37 2008
@@ -36,6 +36,7 @@
[Widget] private Gtk.TreeView adv_tree_view;
[Widget] private Gtk.Button adv_use_button;
[Widget] private Gtk.Button adv_add_button;
+ [Widget] private Gtk.Expander advanced_expander;
public Editor (SmartPlaylistSource playlist) : base ("SmartPlaylistEditorDialog")
{
@@ -51,11 +52,20 @@
name_entry.Text = playlist.Name;
+ UpdateForPlaylist ();
+ }
+
+ private void UpdateForPlaylist ()
+ {
+ currently_editing = playlist;
+ this.primary_source = playlist.PrimarySource;
+
+ PlaylistName = playlist.Name;
Condition = playlist.ConditionTree;
- Limit = playlist.Limit;
+ LimitEnabled = playlist.IsLimited;
LimitValue = playlist.LimitValue;
+ Limit = playlist.Limit;
Order = playlist.QueryOrder;
- LimitEnabled = playlist.IsLimited;
}
public Editor (PrimarySource primary_source) : base ("SmartPlaylistEditorDialog")
@@ -77,56 +87,20 @@
name_entry.Changed += HandleNameChanged;
- // Model is Name, Condition, OrderBy, LimitNumber, LimitCriterion
- ListStore list_model = new ListStore (typeof(string), typeof(string), typeof(string), typeof(string), typeof(string));
+ // Model is Name, SmartPlaylistDefinition
+ ListStore list_model = new ListStore (typeof(string), typeof(SmartPlaylistDefinition));
- // FIXME this is broken
- /*list_model.AppendValues (
- Catalog.GetString ("Neglected Favorites"),
- "Rating>3 played<=\"2 weeks ago\"",
- null, "0", null);*/
-
- // TODO this one is broken, not supported by the condition GUI
- /*list_model.AppendValues (
- Catalog.GetString ("Unrated"),
- " (Rating = NULL) ",
- null, "0", 0);*/
-
- list_model.AppendValues (
- Catalog.GetString ("700 MB of Favorites"),
- "rating>3",
- "PlayCount-DESC",
- "700",
- "MB"
- );
-
- list_model.AppendValues (
- Catalog.GetString ("80 Minutes of Favorites"),
- "rating>3",
- "PlayCount-DESC",
- "80",
- "minutes"
- );
-
- list_model.AppendValues (
- Catalog.GetString ("Unheard"),
- "playcount=0",
- null,
- "0",
- null
- );
-
- list_model.AppendValues (
- Catalog.GetString ("Unheard Podcasts"),
- "playcount=0 location:podcast",
- null,
- "0",
- null
- );
+ bool have_any_predefined = false;
+ foreach (SmartPlaylistDefinition def in primary_source.PredefinedSmartPlaylists) {
+ list_model.AppendValues (
+ String.Format ("<b>{0}</b>\n<i>{1}</i>", def.Name, def.Description), def
+ );
+ have_any_predefined = true;
+ }
adv_tree_view.Selection.Mode = SelectionMode.Multiple;
adv_tree_view.Model = list_model;
- adv_tree_view.AppendColumn ("title", new CellRendererText (), "text", 0);
+ adv_tree_view.AppendColumn ("title", new CellRendererText (), "markup", 0);
adv_tree_view.Selection.Changed += HandleAdvSelectionChanged;
UpdateAdvButtons (0);
@@ -134,6 +108,11 @@
adv_add_button.Clicked += HandleAdvAdd;
adv_use_button.Clicked += HandleAdvUse;
+ if (!have_any_predefined) {
+ advanced_expander.NoShowAll = true;
+ advanced_expander.Hide ();
+ }
+
Update ();
name_entry.GrabFocus ();
@@ -284,15 +263,8 @@
foreach (TreePath path in paths) {
TreeIter iter;
if (adv_tree_view.Model.GetIter (out iter, path)) {
- string name = adv_tree_view.Model.GetValue (iter, 0) as string;
- UserQueryParser parser = new UserQueryParser (adv_tree_view.Model.GetValue (iter, 1) as string);
- QueryNode condition = parser.BuildTree (BansheeQuery.FieldSet);
- QueryOrder order = BansheeQuery.FindOrder (adv_tree_view.Model.GetValue (iter, 2) as string);
- IntegerQueryValue val = new IntegerQueryValue ();
- val.ParseUserQuery (adv_tree_view.Model.GetValue (iter, 3) as string);
- QueryLimit limit = BansheeQuery.FindLimit (adv_tree_view.Model.GetValue (iter, 4) as string);
-
- SmartPlaylistSource pl = new SmartPlaylistSource (name, condition, order, limit, val, primary_source.DbId);
+ SmartPlaylistDefinition def = ((SmartPlaylistDefinition)adv_tree_view.Model.GetValue (iter, 1));
+ SmartPlaylistSource pl = def.ToSmartPlaylistSource (primary_source);
pl.Save ();
pl.PrimarySource.AddChildSource (pl);
pl.RefreshAndReload ();
@@ -312,19 +284,10 @@
return;
TreeIter iter;
-
if (adv_tree_view.Model.GetIter (out iter, paths[0])) {
- PlaylistName = adv_tree_view.Model.GetValue (iter, 0) as string;
- UserQueryParser parser = new UserQueryParser (adv_tree_view.Model.GetValue (iter, 1) as string);
- Condition = parser.BuildTree (BansheeQuery.FieldSet);
- Order = BansheeQuery.FindOrder (adv_tree_view.Model.GetValue (iter, 2) as string);
- QueryLimit limit = BansheeQuery.FindLimit (adv_tree_view.Model.GetValue (iter, 4) as string);
- Limit = limit;
- LimitEnabled = limit != null;
-
- IntegerQueryValue val = new IntegerQueryValue ();
- val.ParseUserQuery (adv_tree_view.Model.GetValue (iter, 3) as string);
- LimitValue = val;
+ SmartPlaylistDefinition def = ((SmartPlaylistDefinition)adv_tree_view.Model.GetValue (iter, 1));
+ this.playlist = def.ToSmartPlaylistSource (primary_source);
+ UpdateForPlaylist ();
}
}
Modified: trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/LastfmActions.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/LastfmActions.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/LastfmActions.cs Sat May 3 00:33:37 2008
@@ -185,6 +185,9 @@
}
);
+ this["LastfmLoveAction"].IsImportant = true;
+ this["LastfmHateAction"].IsImportant = true;
+
actions_id = action_service.UIManager.AddUiFromResource ("GlobalUI.xml");
action_service.AddActionGroup (this);
Modified: trunk/banshee/src/Libraries/Hyena/Hyena.CommandLine/CommandLineParser.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena/Hyena.CommandLine/CommandLineParser.cs (original)
+++ trunk/banshee/src/Libraries/Hyena/Hyena.CommandLine/CommandLineParser.cs Sat May 3 00:33:37 2008
@@ -106,8 +106,9 @@
public string this[string name] {
get { return Contains (name) ? parsed_arguments[name] : String.Empty; }
+ set { parsed_arguments[name] = value; }
}
-
+
public ReadOnlyCollection<string> Files {
get { return new ReadOnlyCollection<string> (file_list); }
}
Modified: trunk/banshee/tests/Banshee.Core/FileNamePatternTests.cs
==============================================================================
--- trunk/banshee/tests/Banshee.Core/FileNamePatternTests.cs (original)
+++ trunk/banshee/tests/Banshee.Core/FileNamePatternTests.cs Sat May 3 00:33:37 2008
@@ -1,3 +1,31 @@
+//
+// FileNamePatternTests.cs
+//
+// Author:
+// Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 2008 Novell, Inc.
+//
+// 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.
+//
+
using System;
using NUnit.Framework;
Modified: trunk/banshee/tests/Banshee.Core/KernelTests.cs
==============================================================================
--- trunk/banshee/tests/Banshee.Core/KernelTests.cs (original)
+++ trunk/banshee/tests/Banshee.Core/KernelTests.cs Sat May 3 00:33:37 2008
@@ -1,3 +1,31 @@
+//
+// KernelTests.cs
+//
+// Author:
+// Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 2008 Novell, Inc.
+//
+// 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.
+//
+
using System;
using NUnit.Framework;
Modified: trunk/banshee/tests/Banshee.Core/TaglibReadWriteTests.cs
==============================================================================
--- trunk/banshee/tests/Banshee.Core/TaglibReadWriteTests.cs (original)
+++ trunk/banshee/tests/Banshee.Core/TaglibReadWriteTests.cs Sat May 3 00:33:37 2008
@@ -1,3 +1,31 @@
+//
+// TaglibReadWriteTests.cs
+//
+// Author:
+// Gabriel Burt <gburt novell com>
+//
+// Copyright (C) 2008 Novell, Inc.
+//
+// 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.
+//
+
using System;
using NUnit.Framework;
@@ -8,20 +36,14 @@
using Banshee.Configuration.Schema;
[TestFixture]
-public class TaglibReadWriteTests
+public class TaglibReadWriteTests : BansheeTests
{
static string [] files;
- static string pwd;
static TaglibReadWriteTests () {
- Hyena.Log.Debugging = true;
-
- pwd = Mono.Unix.UnixDirectoryInfo.GetCurrentDirectory ();
- AddinManager.Initialize (pwd + "/../bin/");
- Banshee.Configuration.ConfigurationClient.Initialize ();
-
+ AddinManager.Initialize (Pwd + "/../bin/");
files = new string [] {
- pwd + "/data/test.mp3",
+ Pwd + "/data/test.mp3",
};
}
@@ -45,9 +67,9 @@
bool write_metadata = LibrarySchema.WriteMetadata.Get();
LibrarySchema.WriteMetadata.Set (true);
try {
- QueryTests.AssertForEach<string> (files, delegate (string uri) {
+ AssertForEach<string> (files, delegate (string uri) {
string extension = System.IO.Path.GetExtension (uri);
- newuri = new SafeUri (pwd + "/data/test_write." + extension);
+ newuri = new SafeUri (Pwd + "/data/test_write." + extension);
Banshee.IO.File.Copy (new SafeUri (uri), newuri, true);
Modified: trunk/banshee/tests/Banshee.Services/PlaylistFormatTests.cs
==============================================================================
--- trunk/banshee/tests/Banshee.Services/PlaylistFormatTests.cs (original)
+++ trunk/banshee/tests/Banshee.Services/PlaylistFormatTests.cs Sat May 3 00:33:37 2008
@@ -1,3 +1,31 @@
+//
+// PlaylistFormatTests.cs
+//
+// Author:
+// Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 2008 Novell, Inc.
+//
+// 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.
+//
+
using System;
using System.IO;
using System.Collections.Generic;
Added: trunk/banshee/tests/Banshee.Services/SmartPlaylistTests.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/tests/Banshee.Services/SmartPlaylistTests.cs Sat May 3 00:33:37 2008
@@ -0,0 +1,53 @@
+//
+// SmartPlaylistTests.cs
+//
+// Author:
+// Gabriel Burt <gburt novell com>
+//
+// Copyright (C) 2008 Novell, Inc.
+//
+// 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.
+//
+
+using System;
+using NUnit.Framework;
+using Hyena;
+
+using Banshee.Sources;
+using Banshee.Library;
+using Banshee.SmartPlaylist;
+
+[TestFixture]
+public class SmartPlaylistTests : BansheeTests
+{
+ /*[Test]
+ public void TestCanCreateAllPredefinedSmartPlaylists ()
+ {
+ PrimarySource [] primaries = new PrimarySource [] {
+ new MusicLibrarySource (), new VideoLibrarySource ()//, new DapSource (), new PodcastSource ()
+ };
+
+ foreach (PrimarySource source in primaries) {
+ AssertForEach<SmartPlaylistDefinition> (source.PredefinedSmartPlaylists, delegate (SmartPlaylistDefinition def) {
+ def.ToSmartPlaylistSource (source);
+ });
+ }
+ }*/
+}
Added: trunk/banshee/tests/Banshee.ThickClient/GuiTests.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/tests/Banshee.ThickClient/GuiTests.cs Sat May 3 00:33:37 2008
@@ -0,0 +1,51 @@
+//
+// GuiTests.cs
+//
+// Author:
+// Gabriel Burt <gburt novell com>
+//
+// Copyright (C) 2008 Novell, Inc.
+//
+// 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.
+//
+
+using System;
+using System.Reflection;
+using NUnit.Framework;
+
+using Hyena;
+using Banshee.Query;
+
+[TestFixture]
+public class GuiTests : BansheeTests
+{
+ /*[Test]
+ public void TestCanStartBanshee ()
+ {
+ Log.InformationFormat ("About to start Banshee from unit test, this thread = {0}", System.Threading.Thread.CurrentThread.ManagedThreadId);
+ StartBanshee ();
+ Log.Information ("Started Banshee from unit test, sleeping 5 seconds");
+
+ System.Threading.Thread.Sleep (5000);
+
+ Log.Information ("Shutting down Banshee");
+ StopBanshee ();
+ }*/
+}
Added: trunk/banshee/tests/BansheeTests.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/tests/BansheeTests.cs Sat May 3 00:33:37 2008
@@ -0,0 +1,72 @@
+//
+// BansheeTests.cs
+//
+// Author:
+// Gabriel Burt <gburt novell com>
+//
+// Copyright (C) 2008 Novell, Inc.
+//
+// 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.
+//
+
+using System;
+using System.Reflection;
+using NUnit.Framework;
+
+public abstract class BansheeTests
+{
+ public static string Pwd;
+ static BansheeTests () {
+ Hyena.Log.Debugging = true;
+ Pwd = Mono.Unix.UnixDirectoryInfo.GetCurrentDirectory ();
+ //AddinManager.Initialize (Pwd + "/../bin/");
+ }
+
+ public delegate void TestRunner<T> (T item);
+ public static void AssertForEach<T> (System.Collections.Generic.IEnumerable<T> objects, TestRunner<T> runner)
+ {
+ System.Text.StringBuilder sb = new System.Text.StringBuilder ();
+ foreach (T o in objects) {
+ try { runner (o); }
+ catch (AssertionException e) { sb.AppendFormat ("Failed processing {0}: {1}\n", o, e.Message); }
+ catch (Exception e) { sb.AppendFormat ("Failed processing {0}: {1}\n", o, e.ToString ()); }
+ }
+
+ if (sb.Length > 0)
+ Assert.Fail ("\n" + sb.ToString ());
+ }
+
+ public static void StartBanshee ()
+ {
+ System.IO.Directory.CreateDirectory (Pwd + "/tmp");
+ Banshee.Base.ApplicationContext.CommandLine["db"] = Pwd + "/tmp/banshee.db";
+ Banshee.Base.ApplicationContext.CommandLine["uninstalled"] = String.Empty;
+
+ System.Threading.ThreadPool.QueueUserWorkItem (delegate {
+ Banshee.Gui.GtkBaseClient.Entry<Nereid.Client> ();
+ });
+ }
+
+ public static void StopBanshee ()
+ {
+ Banshee.ServiceStack.Application.Shutdown ();
+ Banshee.IO.Directory.Delete (Pwd + "/tmp", true);
+ }
+}
Modified: trunk/banshee/tests/Hyena/CryptoUtilTests.cs
==============================================================================
--- trunk/banshee/tests/Hyena/CryptoUtilTests.cs (original)
+++ trunk/banshee/tests/Hyena/CryptoUtilTests.cs Sat May 3 00:33:37 2008
@@ -1,3 +1,31 @@
+//
+// CryptoUtilTests.cs
+//
+// Author:
+// Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 2008 Novell, Inc.
+//
+// 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.
+//
+
using System;
using NUnit.Framework;
using Hyena;
Modified: trunk/banshee/tests/Hyena/DbBoundType.cs
==============================================================================
--- trunk/banshee/tests/Hyena/DbBoundType.cs (original)
+++ trunk/banshee/tests/Hyena/DbBoundType.cs Sat May 3 00:33:37 2008
@@ -1,3 +1,31 @@
+//
+// DbBoundType.cs
+//
+// Author:
+// Scott Peterson <lunchtimemama gmail com>
+//
+// Copyright (C) 2008 Scott Peterson
+//
+// 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.
+//
+
using System;
using Hyena.Data.Sqlite;
Modified: trunk/banshee/tests/Hyena/QueryTests.cs
==============================================================================
--- trunk/banshee/tests/Hyena/QueryTests.cs (original)
+++ trunk/banshee/tests/Hyena/QueryTests.cs Sat May 3 00:33:37 2008
@@ -1,3 +1,31 @@
+//
+// QueryTests.cs
+//
+// Author:
+// Gabriel Burt <gburt novell com>
+//
+// Copyright (C) 2008 Novell, Inc.
+//
+// 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.
+//
+
using System;
using System.Reflection;
using NUnit.Framework;
@@ -6,7 +34,7 @@
using Banshee.Query;
[TestFixture]
-public class QueryTests
+public class QueryTests : BansheeTests
{
[Test]
public void TestQueryValueSql ()
@@ -71,18 +99,16 @@
AssertForEach<string> (tests, UserQueryParsesAndGenerates);
}
- public delegate void TestRunner<T> (T item);
- public static void AssertForEach<T> (System.Collections.Generic.IEnumerable<T> objects, TestRunner<T> runner)
+ [Test]
+ public void TestCustomFormatParenthesisBugFixed ()
{
- System.Text.StringBuilder sb = new System.Text.StringBuilder ();
- foreach (T o in objects) {
- try { runner (o); }
- catch (AssertionException e) { sb.AppendFormat ("Failed processing {0}: {1}\n", o, e.Message); }
- catch (Exception e) { sb.AppendFormat ("Failed processing {0}: {1}\n", o, e.ToString ()); }
- }
+ QueryValue val = new StringQueryValue ();
+ val.ParseUserQuery ("mp3");
- if (sb.Length > 0)
- Assert.Fail ("\n" + sb.ToString ());
+ Assert.AreEqual (
+ "(CoreTracks.MimeType LIKE '%mp3%' OR CoreTracks.Uri LIKE '%mp3%')",
+ BansheeQuery.MimeTypeField.ToSql (StringQueryValue.Contains, val)
+ );
}
private static void UserQueryParsesAndGenerates (string query)
Modified: trunk/banshee/tests/Hyena/RangeCollectionTests.cs
==============================================================================
--- trunk/banshee/tests/Hyena/RangeCollectionTests.cs (original)
+++ trunk/banshee/tests/Hyena/RangeCollectionTests.cs Sat May 3 00:33:37 2008
@@ -1,3 +1,31 @@
+//
+// RangeCollectionTests.cs
+//
+// Author:
+// Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 2007 Novell, Inc.
+//
+// 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.
+//
+
using System;
using NUnit.Framework;
using Hyena.Collections;
Modified: trunk/banshee/tests/Hyena/SelectionTests.cs
==============================================================================
--- trunk/banshee/tests/Hyena/SelectionTests.cs (original)
+++ trunk/banshee/tests/Hyena/SelectionTests.cs Sat May 3 00:33:37 2008
@@ -1,3 +1,31 @@
+//
+// SelectionTests.cs
+//
+// Author:
+// Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 2008 Novell, Inc.
+//
+// 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.
+//
+
using System;
using Hyena.Data;
Modified: trunk/banshee/tests/Hyena/SqliteCommandTests.cs
==============================================================================
--- trunk/banshee/tests/Hyena/SqliteCommandTests.cs (original)
+++ trunk/banshee/tests/Hyena/SqliteCommandTests.cs Sat May 3 00:33:37 2008
@@ -1,3 +1,31 @@
+//
+// SqliteCommandTests.cs
+//
+// Author:
+// Gabriel Burt <gburt novell com>
+//
+// Copyright (C) 2008 Novell, Inc.
+//
+// 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.
+//
+
using System;
using System.Reflection;
using NUnit.Framework;
Modified: trunk/banshee/tests/Hyena/SqliteModelProviderTests.cs
==============================================================================
--- trunk/banshee/tests/Hyena/SqliteModelProviderTests.cs (original)
+++ trunk/banshee/tests/Hyena/SqliteModelProviderTests.cs Sat May 3 00:33:37 2008
@@ -1,3 +1,31 @@
+//
+// SqliteModelProviderTests.cs
+//
+// Author:
+// Scott Peterson <lunchtimemama gmail com>
+//
+// Copyright (C) 2008 Scott Peterson
+//
+// 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.
+//
+
using System;
using System.Data;
using System.IO;
Modified: trunk/banshee/tests/Hyena/StringUtilTests.cs
==============================================================================
--- trunk/banshee/tests/Hyena/StringUtilTests.cs (original)
+++ trunk/banshee/tests/Hyena/StringUtilTests.cs Sat May 3 00:33:37 2008
@@ -1,3 +1,32 @@
+//
+// StringUtilTests.cs
+//
+// Author:
+// Aaron Bockover <abockover novell com>
+// Gabriel Burt <gburt novell com>
+//
+// Copyright (C) 2008 Novell, Inc.
+//
+// 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.
+//
+
using System;
using NUnit.Framework;
using Hyena;
Modified: trunk/banshee/tests/Makefile.am
==============================================================================
--- trunk/banshee/tests/Makefile.am (original)
+++ trunk/banshee/tests/Makefile.am Sat May 3 00:33:37 2008
@@ -6,6 +6,7 @@
ASSEMBLY_NAME = banshee-tests
ASSEMBLY = $(ASSEMBLY_NAME).dll
ASSEMBLY_CSFILES = \
+ $(srcdir)/BansheeTests.cs \
$(srcdir)/Hyena/CryptoUtilTests.cs \
$(srcdir)/Hyena/DbBoundType.cs \
$(srcdir)/Hyena/RangeCollectionTests.cs \
@@ -13,6 +14,8 @@
$(srcdir)/Hyena/SqliteCommandTests.cs \
$(srcdir)/Hyena/SqliteModelProviderTests.cs \
$(srcdir)/Hyena/QueryTests.cs \
+ $(srcdir)/Banshee.Services/SmartPlaylistTests.cs \
+ $(srcdir)/Banshee.ThickClient/GuiTests.cs \
$(srcdir)/Banshee.Core/TaglibReadWriteTests.cs
# Banshee.Core/KernelTests.cs
@@ -27,7 +30,7 @@
ConsoleUi.cs
$(ASSEMBLY): $(ASSEMBLY_CSFILES)
- $(MCS) $(MCS_FLAGS) $(NUNIT_FLAGS) -out:$@ -target:library -r:System.Xml $(LINK_HYENA_DEPS) $(LINK_BANSHEE_CORE_DEPS) $(LINK_BANSHEE_THICKCLIENT_DEPS) $(ASSEMBLY_CSFILES) $(REF_BACKEND_UNIX) -r:$(DIR_BIN)/Banshee.Unix.dll
+ $(MCS) $(MCS_FLAGS) $(NUNIT_FLAGS) -out:$@ -target:library -r:System.Xml $(LINK_HYENA_DEPS) $(LINK_BANSHEE_CORE_DEPS) $(LINK_BANSHEE_THICKCLIENT_DEPS) $(LINK_NEREID_DEPS) $(ASSEMBLY_CSFILES) $(REF_BACKEND_UNIX) -r:$(DIR_BIN)/Banshee.Unix.dll
$(NUNIT_TESTER): $(NUNIT_TESTER_CSFILES)
$(MCS) $(MCS_FLAGS) -out:$@ $(NUNIT_FLAGS) $(NUNIT_TESTER_CSFILES)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]