Author: suokko
Date: Mon Aug 25 17:38:57 2008
New Revision: 28975
URL: http://svn.gna.org/viewcvs/wesnoth?rev=28975&view=rev
Log:
Fixed test use corret way to translate t_sring for compareing with parsed
config object
Modified:
trunk/src/tests/main.cpp
trunk/src/tests/test_config_cache.cpp
Modified: trunk/src/tests/main.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/tests/main.cpp?rev=28975&r1=28974&r2=28975&view=diff
==============================================================================
--- trunk/src/tests/main.cpp (original)
+++ trunk/src/tests/main.cpp Mon Aug 25 17:38:57 2008
@@ -43,10 +43,18 @@
throw
boost::execution_exception(boost::execution_exception::cpp_exception_error,
"network::error: " + e.message);
}
+
+
static void exception_translator_game(const game::error& e)
{
throw
boost::execution_exception(boost::execution_exception::cpp_exception_error,
"game::error: " + e.message);
}
+
+static bool match_english(const language_def& def)
+{
+ return def.localename == "C";
+}
+
struct wesnoth_global_fixture {
wesnoth_global_fixture()
@@ -56,6 +64,12 @@
load_language_list();
::init_textdomains(game_config::config_cache::instance().get_config());
+ const std::vector<language_def>& languages = get_languages();
+ std::vector<language_def>::const_iterator English =
std::find_if(languages.begin(),
+
languages.end(),
+
match_english); // Using German because the most active translation
+ ::set_language(*English);
+
// Initialize unit tests
SDL_Init(SDL_INIT_TIMER);
Modified: trunk/src/tests/test_config_cache.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/tests/test_config_cache.cpp?rev=28975&r1=28974&r2=28975&view=diff
==============================================================================
--- trunk/src/tests/test_config_cache.cpp (original)
+++ trunk/src/tests/test_config_cache.cpp Mon Aug 25 17:38:57 2008
@@ -122,7 +122,7 @@
cache.add_define("TEST_DEFINE");
child = &test_config.add_child("test_key");
- (*child)["define"] = _("testing translation reset.");
+ (*child)["define"] = t_string("testing translation reset.",
GETTEXT_DOMAIN);
BOOST_CHECK_EQUAL(test_config, cache.get_config());
@@ -144,9 +144,10 @@
(*child)["define"] = "test";
child = &test_config.add_child("test_key");
- (*child)["define"] = _("testing translation reset.");
+ (*child)["define"] = t_string("testing translation reset.",
GETTEXT_DOMAIN);
// Change language
+ const language_def& original_lang = get_language();
const std::vector<language_def>& languages = get_languages();
BOOST_CHECK_MESSAGE(languages.size()>0, "No languages found!");
std::vector<language_def>::const_iterator German =
std::find_if(languages.begin(),
@@ -156,11 +157,12 @@
::set_language(*German);
cache.reload_translations();
- BOOST_CHECK_MESSAGE( test_config != cache.get_config(), "Translation
update failed update translations!" );
+ BOOST_CHECK_MESSAGE( test_config != cache.get_config(), "Translation
update failed to update translations!" );
- (*child)["define"] = _("testing translation reset.");
+ (*child)["define"].reset_translation();
BOOST_CHECK_EQUAL(test_config, cache.get_config());
+ set_language(original_lang);
}
/* vim: set ts=4 sw=4: */
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits