fantasdic r339 - in trunk: . lib/fantasdic test
- From: mblondel svn gnome org
- To: svn-commits-list gnome org
- Subject: fantasdic r339 - in trunk: . lib/fantasdic test
- Date: Mon, 25 Aug 2008 15:58:04 +0000 (UTC)
Author: mblondel
Date: Mon Aug 25 15:58:04 2008
New Revision: 339
URL: http://svn.gnome.org/viewvc/fantasdic?rev=339&view=rev
Log:
* lib/fantasdic/preferences.rb: Include the name of the dictionary in the
configuration hash.
* test/test_preferences.rb: Updated accordingly.
Modified:
trunk/ChangeLog
trunk/lib/fantasdic/preferences.rb
trunk/test/test_preferences.rb
Modified: trunk/lib/fantasdic/preferences.rb
==============================================================================
--- trunk/lib/fantasdic/preferences.rb (original)
+++ trunk/lib/fantasdic/preferences.rb Mon Aug 25 15:58:04 2008
@@ -50,6 +50,13 @@
else
@config = YAML.load(File.open(Config::DEFAULT_CONFIG_FILE))
end
+
+ # copy the name of the dictionary in the dictionary info
+ # so that it is available to the source object
+ # when the config hash is passed
+ self.dictionaries_infos.each_key do |key|
+ self.dictionaries_infos[key][:name] = key
+ end
end
def save!
@@ -66,6 +73,7 @@
def update_dictionary(name, hash)
self.dictionaries_infos[name] = hash
+ self.dictionaries_infos[name][:name] = name
end
def add_dictionary(name, hash)
Modified: trunk/test/test_preferences.rb
==============================================================================
--- trunk/test/test_preferences.rb (original)
+++ trunk/test/test_preferences.rb Mon Aug 25 15:58:04 2008
@@ -43,6 +43,7 @@
{"English"=>
{:login=>"",
:password=>"",
+ :name => "English",
:all_dbs=>false,
:selected=>1,
:sel_dbs=>["foldoc", "gcide", "wn", "jargon"],
@@ -63,6 +64,7 @@
"Spanish"=>
{:login=>"",
:password=>"",
+ :name => "Spanish",
:all_dbs=>true,
:selected=>1,
:sel_dbs=>[],
@@ -83,6 +85,7 @@
"English <-> French"=>
{:login=>"",
:password=>"",
+ :name => "English <-> French",
:all_dbs=>false,
:selected=>1,
:sel_dbs=>["eng-fra", "fra-eng"],
@@ -103,6 +106,7 @@
"Japanese"=>
{:login=>"",
:password=>"",
+ :name => "Japanese",
:all_dbs=>true,
:selected=>1,
:sel_dbs=>[],
@@ -126,19 +130,24 @@
end
def test_update_dictionary
- assert_not_equal(@prefs.dictionaries_infos["Japanese"], {})
+ assert_not_equal(@prefs.dictionaries_infos["Japanese"],
+ {:name=>"Japanese"})
@prefs.update_dictionary("Japanese", {})
- assert_equal(@prefs.dictionaries_infos["Japanese"], {})
+ assert_equal(@prefs.dictionaries_infos["Japanese"],
+ {:name=>"Japanese"})
end
def test_add_dictionary
- assert_not_equal(@prefs.dictionaries_infos["Japanese"], {})
+ assert_not_equal(@prefs.dictionaries_infos["Japanese"],
+ {:name => "Japanese"})
@prefs.add_dictionary("Japanese", {})
- assert_equal(@prefs.dictionaries_infos["Japanese"], {})
+ assert_equal(@prefs.dictionaries_infos["Japanese"],
+ {:name => "Japanese"})
assert_equal(@prefs.dictionaries_infos.has_key?("New"), false)
@prefs.add_dictionary("New", {})
- assert_equal(@prefs.dictionaries_infos["New"], {})
+ assert_equal(@prefs.dictionaries_infos["New"],
+ {:name=>"New"})
end
def test_delete_dictionary
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]