Skip to content

Commit

Permalink
Add missing GUI2 windows to test
Browse files Browse the repository at this point in the history
  • Loading branch information
AI0867 committed May 9, 2014
1 parent fc7cf30 commit f3831b6
Showing 1 changed file with 141 additions and 0 deletions.
141 changes: 141 additions & 0 deletions src/tests/gui/test_gui2.cpp
Expand Up @@ -33,6 +33,7 @@
#include "gui/dialogs/data_manage.hpp"
#include "gui/dialogs/debug_clock.hpp"
#include "gui/dialogs/edit_label.hpp"
#include "gui/dialogs/edit_text.hpp"
#include "gui/dialogs/editor_generate_map.hpp"
#include "gui/dialogs/editor_new_map.hpp"
#include "gui/dialogs/editor_resize_map.hpp"
Expand All @@ -41,23 +42,31 @@
#include "gui/dialogs/formula_debugger.hpp"
#include "gui/dialogs/game_delete.hpp"
#include "gui/dialogs/game_load.hpp"
#include "gui/dialogs/game_paths.hpp"
#include "gui/dialogs/game_save.hpp"
#include "gui/dialogs/gamestate_inspector.hpp"
#include "gui/dialogs/language_selection.hpp"
#include "gui/dialogs/lobby_main.hpp"
#include "gui/dialogs/lobby_player_info.hpp"
#include "gui/dialogs/message.hpp"
#include "gui/dialogs/mp_change_control.hpp"
#include "gui/dialogs/mp_cmd_wrapper.hpp"
#include "gui/dialogs/mp_connect.hpp"
#include "gui/dialogs/mp_create_game.hpp"
#include "gui/dialogs/mp_create_game_set_password.hpp"
#include "gui/dialogs/mp_depcheck_confirm_change.hpp"
#include "gui/dialogs/mp_depcheck_select_new.hpp"
#include "gui/dialogs/mp_login.hpp"
#include "gui/dialogs/mp_method_selection.hpp"
#include "gui/dialogs/simple_item_selector.hpp"
#include "gui/dialogs/screenshot_notification.hpp"
#include "gui/dialogs/theme_list.hpp"
#include "gui/dialogs/title_screen.hpp"
#include "gui/dialogs/tip.hpp"
#include "gui/dialogs/transient_message.hpp"
#include "gui/dialogs/unit_attack.hpp"
#include "gui/dialogs/unit_create.hpp"
#include "gui/dialogs/wml_error.hpp"
#include "gui/dialogs/wml_message.hpp"
#include "gui/widgets/settings.hpp"
#include "gui/widgets/window.hpp"
Expand Down Expand Up @@ -362,6 +371,7 @@ BOOST_AUTO_TEST_CASE(test_gui2)
// test<gui2::tchat_log>(); /** @todo ENABLE */
test<gui2::tdata_manage>();
test<gui2::tedit_label>();
test<gui2::tedit_text>();
test<gui2::teditor_generate_map>();
test<gui2::teditor_new_map>();
test<gui2::teditor_resize_map>();
Expand All @@ -370,25 +380,33 @@ BOOST_AUTO_TEST_CASE(test_gui2)
test<gui2::tformula_debugger>();
test<gui2::tgame_delete>();
test<gui2::tgame_load>();
test<gui2::tgame_paths>();
test<gui2::tgame_save>();
test<gui2::tgame_save_message>();
test<gui2::tgame_save_oos>();
test<gui2::tgamestate_inspector>();
test<gui2::tlanguage_selection>();
test<gui2::tlobby_main>();
test<gui2::tlobby_player_info>();
test<gui2::tmessage>();
test<gui2::tmp_change_control>();
test<gui2::tmp_cmd_wrapper>();
test<gui2::tmp_connect>();
test<gui2::tmp_create_game>();
test<gui2::tmp_create_game_set_password>();
test<gui2::tmp_depcheck_confirm_change>();
test<gui2::tmp_depcheck_select_new>();
test<gui2::tmp_login>();
test<gui2::tmp_method_selection>();
test<gui2::tmp_server_list>();
test<gui2::tsimple_item_selector>();
test<gui2::tscreenshot_notification>();
test<gui2::ttheme_list>();
test<gui2::ttitle_screen>();
test<gui2::ttransient_message>();
// test<gui2::tunit_attack>(); /** @todo ENABLE */
test<gui2::tunit_create>();
test<gui2::twml_error>();
test<gui2::twml_message_left>();
test<gui2::twml_message_right>();

Expand Down Expand Up @@ -517,6 +535,16 @@ struct twrapper<gui2::tedit_label>
}
};

template<>
struct twrapper<gui2::tedit_text>
{
static gui2::tedit_text* create()
{
static std::string text = "text to modify";
return new gui2::tedit_text("title", "label", text);
}
};

template<>
struct twrapper<gui2::tformula_debugger>
{
Expand All @@ -539,6 +567,16 @@ struct twrapper<gui2::tgame_load>

};

template<>
struct twrapper<gui2::tgame_paths>
{
static gui2::tgame_paths* create()
{
return new gui2::tgame_paths();
}

};

template<>
struct twrapper<gui2::tgame_save>
{
Expand Down Expand Up @@ -594,6 +632,38 @@ struct twrapper<gui2::tgamestate_inspector>

};

template<>
struct twrapper<gui2::tlobby_main>
{
static gui2::tlobby_main* create()
{
config game_config;
lobby_info li(game_config);
return new gui2::tlobby_main(game_config, li,
*static_cast<display*>(&test_utils::get_fake_display(-1, -1)));
}
};

class fake_chat_handler : public events::chat_handler {
void add_chat_message(const time_t&,
const std::string&, int, const std::string&,
MESSAGE_TYPE) {}
void send_chat_message(const std::string&, bool) {}
};

template<>
struct twrapper<gui2::tlobby_player_info>
{
static gui2::tlobby_player_info* create()
{
config c;
static fake_chat_handler ch;
static user_info ui(c);
static lobby_info li(c);
return new gui2::tlobby_player_info(ch, ui, li);
}
};

template<>
struct twrapper<gui2::tmessage>
{
Expand Down Expand Up @@ -630,6 +700,42 @@ struct twrapper<gui2::tmp_create_game>
}
};

template<>
struct twrapper<gui2::tmp_create_game_set_password>
{
static gui2::tmp_create_game_set_password* create()
{
static std::string password;
return new gui2::tmp_create_game_set_password(password);
}
};

template<>
struct twrapper<gui2::tmp_depcheck_confirm_change>
{
static gui2::tmp_depcheck_confirm_change* create()
{
std::vector<std::string> mods;
mods.push_back("mod one");
mods.push_back("some other");
mods.push_back("more");
return new gui2::tmp_depcheck_confirm_change(true, mods, "requester");
}
};

template<>
struct twrapper<gui2::tmp_depcheck_select_new>
{
static gui2::tmp_depcheck_select_new* create()
{
std::vector<std::string> mods;
mods.push_back("mod one");
mods.push_back("some other");
mods.push_back("more");
return new gui2::tmp_depcheck_select_new(mp::depcheck::MODIFICATION, mods);
}
};

template<>
struct twrapper<gui2::tmp_login>
{
Expand Down Expand Up @@ -662,6 +768,28 @@ struct twrapper<gui2::tscreenshot_notification>
}
};

template<>
struct twrapper<gui2::ttheme_list>
{
static theme_info make_theme(std::string name)
{
theme_info ti;
ti.id = name;
ti.name = name;
ti.description = name + " this is a description";
return ti;
}
static gui2::ttheme_list* create()
{
std::vector<theme_info> themes;
themes.push_back(make_theme("classic"));
themes.push_back(make_theme("new"));
themes.push_back(make_theme("more"));
themes.push_back(make_theme("themes"));
return new gui2::ttheme_list(themes, 0);
}
};

template<>
struct twrapper<gui2::teditor_generate_map>
{
Expand Down Expand Up @@ -757,6 +885,19 @@ struct twrapper<gui2::ttransient_message>
}
};

template<>
struct twrapper<gui2::twml_error>
{
static gui2::twml_error* create()
{
std::vector<std::string> files;
files.push_back("some");
files.push_back("files");
files.push_back("here");
return new gui2::twml_error("Summary", "Post summary", files, "Details");
}
};

template<>
struct twrapper<gui2::twml_message_left>
{
Expand Down

0 comments on commit f3831b6

Please sign in to comment.