[banshee/gtk3] build: add first GSettingsSchemaExtractor tests
- From: AndrÃs Aragoneses <aaragoneses src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee/gtk3] build: add first GSettingsSchemaExtractor tests
- Date: Tue, 18 Dec 2012 03:35:37 +0000 (UTC)
commit 164b46131a7aef9723f72137a178b87803080815
Author: Andres G. Aragoneses <knocte gmail com>
Date: Tue Dec 18 03:35:28 2012 +0000
build: add first GSettingsSchemaExtractor tests
build/GConfSchemaExtractorTests.cs | 2 +-
build/GSettingsSchemaExtractorTests.cs | 154 ++++++++++++++++++++++++++++++++
2 files changed, 155 insertions(+), 1 deletions(-)
---
diff --git a/build/GConfSchemaExtractorTests.cs b/build/GConfSchemaExtractorTests.cs
index c84324f..697db9f 100644
--- a/build/GConfSchemaExtractorTests.cs
+++ b/build/GConfSchemaExtractorTests.cs
@@ -1,5 +1,5 @@
//
-// Tests.cs
+// GConfSchemaExtractorTests.cs
//
// Author:
// Andres G. Aragoneses <knocte gmail com>
diff --git a/build/GSettingsSchemaExtractorTests.cs b/build/GSettingsSchemaExtractorTests.cs
new file mode 100644
index 0000000..c0fb723
--- /dev/null
+++ b/build/GSettingsSchemaExtractorTests.cs
@@ -0,0 +1,154 @@
+//
+// GSettingsExtractorTests.cs
+//
+// Author:
+// Andres G. Aragoneses <knocte gmail com>
+//
+// Copyright 2012 Andres G. Aragoneses
+//
+// 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.Text;
+
+using Banshee.Configuration;
+
+using NUnit.Framework;
+
+namespace GSettingsSchemaExtractor
+{
+ [TestFixture]
+ public class Tests
+ {
+ internal class StringType {
+ public static readonly SchemaEntry<string> DefaultExportFormat = new SchemaEntry<string> (
+ "player_window", "default_export_format",
+ "m3u",
+ "Export Format",
+ "The default playlist export format"
+ );
+ }
+
+ [Test]
+ public void SchemaWithString ()
+ {
+ StringBuilder result = GSettingsSchemaExtractorProgram.Extract (new Type [] { typeof (StringType) });
+
+ Assert.That (result, Is.Not.Null);
+ Assert.That (result.ToString ().Trim (), Is.EqualTo (@"
+<schemalist>
+ <schema id=""org.gnome.banshee.player_window"" path=""/apps/banshee/player_window/"">
+ <key name=""default_export_format"" type=""s"">
+ <default>'m3u'</default>
+ <_summary>Export Format</_summary>
+ <_description>The default playlist export format</_description>
+ </key>
+ </schema>
+</schemalist>"
+ .Trim ()));
+ }
+
+
+ internal class BooleanType
+ {
+ public static readonly SchemaEntry<bool> ShowInitialImportDialog = new SchemaEntry<bool>(
+ "import", "show_initial_import_dialog",
+ true,
+ "Show the Initial Import Dialog",
+ "Show the Initial Import Dialog when the Banshee library is empty"
+ );
+ }
+
+ [Test]
+ public void SchemaWithBoolean ()
+ {
+ StringBuilder result = GSettingsSchemaExtractorProgram.Extract (new Type [] { typeof (BooleanType) });
+
+ Assert.That (result, Is.Not.Null);
+ Assert.That (result.ToString ().Trim (), Is.EqualTo (@"
+<schemalist>
+ <schema id=""org.gnome.banshee.import"" path=""/apps/banshee/import/"">
+ <key name=""show_initial_import_dialog"" type=""b"">
+ <default>true</default>
+ <_summary>Show the Initial Import Dialog</_summary>
+ <_description>Show the Initial Import Dialog when the Banshee library is empty</_description>
+ </key>
+ </schema>
+</schemalist>"
+ .Trim ()));
+ }
+
+ internal class IntegerType {
+ public static readonly SchemaEntry<int> VolumeSchema = new SchemaEntry<int> (
+ "player_engine", "volume",
+ 80,
+ "Volume",
+ "Volume of playback relative to mixer output"
+ );
+ }
+
+ [Test]
+ public void SchemaWithInt ()
+ {
+ StringBuilder result = GSettingsSchemaExtractorProgram.Extract (new Type [] { typeof (IntegerType) });
+
+ Assert.That (result, Is.Not.Null);
+ Assert.That (result.ToString ().Trim (), Is.EqualTo (@"
+<schemalist>
+ <schema id=""org.gnome.banshee.player_engine"" path=""/apps/banshee/player_engine/"">
+ <key name=""volume"" type=""i"">
+ <default>80</default>
+ <_summary>Volume</_summary>
+ <_description>Volume of playback relative to mixer output</_description>
+ </key>
+ </schema>
+</schemalist>"
+ .Trim ()));
+ }
+
+ internal class DoubleType {
+ public static readonly SchemaEntry<double> CoverArtSize = new SchemaEntry<double> (
+ "player_window", "cover_art_size",
+ 20.5,
+ "Cover art size",
+ "Surface size of cover art in the album grid"
+ );
+ }
+
+ [Test]
+ public void SchemaWithDouble ()
+ {
+ StringBuilder result = GSettingsSchemaExtractorProgram.Extract (new Type [] { typeof (DoubleType) });
+
+ Assert.That (result, Is.Not.Null);
+ Assert.That (result.ToString ().Trim (), Is.EqualTo (@"
+<schemalist>
+ <schema id=""org.gnome.banshee.player_window"" path=""/apps/banshee/player_window/"">
+ <key name=""cover_art_size"" type=""d"">
+ <default>20.5</default>
+ <_summary>Cover art size</_summary>
+ <_description>Surface size of cover art in the album grid</_description>
+ </key>
+ </schema>
+</schemalist>"
+ .Trim ()));
+ }
+ }
+}
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]