mail[Wesnoth-commits] r29001 - in /trunk/src: config_cache.cpp tests/main.cpp tests/test_config_cache.cpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by paniemin on August 26, 2008 - 22:11:
Author: suokko
Date: Tue Aug 26 22:11:03 2008
New Revision: 29001

URL: http://svn.gna.org/viewcvs/wesnoth?rev=29001&view=rev
Log:
* Fixed cache to write in requested format

Modified:
    trunk/src/config_cache.cpp
    trunk/src/tests/main.cpp
    trunk/src/tests/test_config_cache.cpp

Modified: trunk/src/config_cache.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/config_cache.cpp?rev=29001&r1=29000&r2=29001&view=diff
==============================================================================
--- trunk/src/config_cache.cpp (original)
+++ trunk/src/config_cache.cpp Tue Aug 26 22:11:03 2008
@@ -87,38 +87,33 @@
 
        void config_cache::write_file(std::string path, const config& cfg)
        {
-               bool gzip = false;
+               scoped_ostream stream = ostream_file(path);
                switch(game_config::cache_type)
                {
                        case GZIP:
-                               gzip = true;
-                               path += ".gz";
-                       case BWML:
                                {
-                                       scoped_ostream stream = 
ostream_file(path);
+                                       const bool gzip = true;
                                        config_writer 
writer(*stream,gzip,"",game_config::cache_compression_level);
                                        writer.write(cfg);
                                }
                                break;
+                       case BWML:
+                               write_compressed(*stream, cfg);
+                               break;
                }
        }
 
        void config_cache::read_file(const std::string& path, config& cfg)
        {
                std::string error_log;
+               scoped_istream stream = istream_file(path);
                switch(game_config::cache_type)
                {
                        case BWML:
-                               {
-                                       scoped_istream stream = 
istream_file(path);
-                                       read(cfg, *stream);
-                               }
+                               read_compressed(cfg, *stream);
                                break;
                        case GZIP:
-                               {
-                                       scoped_istream stream = 
istream_file(path + ".gz");
-                                       read_gz(cfg, *stream);
-                               }
+                               read_gz(cfg, *stream);
                                break;
                }
        }

Modified: trunk/src/tests/main.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/tests/main.cpp?rev=29001&r1=29000&r2=29001&view=diff
==============================================================================
--- trunk/src/tests/main.cpp (original)
+++ trunk/src/tests/main.cpp Tue Aug 26 22:11:03 2008
@@ -59,11 +59,13 @@
 struct wesnoth_global_fixture {
        wesnoth_global_fixture() 
        {
+//             lg::set_log_domain_severity("all",3);
                game_config::use_dummylocales = true;
                game_config::path = get_cwd();
 
                load_language_list();
-               
::init_textdomains(*game_config::config_cache::instance().get_config(game_config::path
 + "/data/_main.cfg"));
+               game_config::config_cache::instance().add_define("TEST");
+               
::init_textdomains(*game_config::config_cache::instance().get_config(game_config::path
 + "/data/test/"));
                const std::vector<language_def>& languages = get_languages();
                std::vector<language_def>::const_iterator English = 
std::find_if(languages.begin(),
                                                                        
languages.end(),
@@ -75,7 +77,6 @@
                SDL_Init(SDL_INIT_TIMER);
                test_utils::get_fake_display();
 
-//             lg::set_log_domain_severity("all",3);
 
                // Set more report as default
                if (boost::unit_test::runtime_config::log_level() == 
boost::unit_test::invalid_log_level)

Modified: trunk/src/tests/test_config_cache.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/tests/test_config_cache.cpp?rev=29001&r1=29000&r2=29001&view=diff
==============================================================================
--- trunk/src/tests/test_config_cache.cpp (original)
+++ trunk/src/tests/test_config_cache.cpp Tue Aug 26 22:11:03 2008
@@ -119,6 +119,7 @@
        BOOST_CHECK_EQUAL(test_config, *cache.get_config(test_data_path));
 
        BOOST_CHECK_EQUAL((*test_config.child("test_key2"))["define"].str(), 
(*cache.get_config(test_data_path)->child("test_key2"))["define"].str());
+       
BOOST_CHECK_EQUAL((*test_config.child("test_key2"))["define"].translatable(), 
(*cache.get_config(test_data_path)->child("test_key2"))["define"].translatable());
 }
 
 BOOST_AUTO_TEST_CASE( test_preproc_defines )




Related Messages


Powered by MHonArc, Updated Tue Aug 26 22:21:40 2008