Enable the unit test for tmp_server_list.

It involves the tmp_connect class since it has access to the class, not
really clean, but marked for unit tests only.
This commit is contained in:
Mark de Wever 2011-03-06 14:14:07 +00:00
parent f032fe7159
commit d33c8fcf4f
3 changed files with 33 additions and 5 deletions

View File

@ -181,5 +181,10 @@ void tmp_connect::pre_show(CVideo& video, twindow& window)
}
tdialog* tmp_connect::mp_server_list_for_unit_test()
{
return new tmp_server_list();
}
} // namespace gui2

View File

@ -22,6 +22,8 @@ namespace gui2 {
class tmp_connect : public tdialog
{
/** The unit test needs to be able to test the tmp_connect dialog. */
friend tdialog* unit_test_mp_server_list();
public:
tmp_connect();
@ -35,6 +37,13 @@ private:
/** The host name of the selected servef. */
tfield_text* host_name_;
/**
* The unit test needs to be able to test the tmp_connect dialog.
*
* @returns A newly allocated tmp_server_list.
*/
static tdialog* mp_server_list_for_unit_test();
};
} // namespace gui2

View File

@ -84,7 +84,15 @@ std::string unit_test_mark_as_tested(const tdialog& dialog)
return dialog.window_id();
}
}// namespace gui2
class tmp_server_list;
tdialog* unit_test_mp_server_list()
{
return tmp_connect::mp_server_list_for_unit_test();
}
} // namespace gui2
namespace {
@ -225,7 +233,7 @@ BOOST_AUTO_TEST_CASE(test_gui2)
test<gui2::tmp_create_game>();
test<gui2::tmp_login>();
test<gui2::tmp_method_selection>();
// test<gui2::tmp_server_list>(); /** @todo ENABLE */
test<gui2::tmp_server_list>();
test<gui2::ttitle_screen>();
test<gui2::ttransient_message>();
// test<gui2::tunit_attack>(); /** @todo ENABLE */
@ -250,9 +258,6 @@ BOOST_AUTO_TEST_CASE(test_gui2)
list.erase(
std::remove(list.begin(), list.end(), "unit_attack")
, list.end());
list.erase(
std::remove(list.begin(), list.end(), "mp_server_list")
, list.end());
list.erase(
std::remove(list.begin(), list.end(), "tooltip_large")
, list.end());
@ -501,6 +506,15 @@ struct twrapper<gui2::teditor_settings>
}
};
template<>
struct twrapper<gui2::tmp_server_list>
{
static gui2::tdialog* create()
{
return gui2::unit_test_mp_server_list();
}
};
template<>
struct twrapper<gui2::ttransient_message>
{