Author: mordante
Date: Sun Mar 6 15:14:07 2011
New Revision: 48784
URL: http://svn.gna.org/viewcvs/wesnoth?rev=48784&view=rev
Log:
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.
Modified:
trunk/src/gui/dialogs/mp_connect.cpp
trunk/src/gui/dialogs/mp_connect.hpp
trunk/src/tests/gui/test_gui2.cpp
Modified: trunk/src/gui/dialogs/mp_connect.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/dialogs/mp_connect.cpp?rev=48784&r1=48783&r2=48784&view=diff
==============================================================================
--- trunk/src/gui/dialogs/mp_connect.cpp (original)
+++ trunk/src/gui/dialogs/mp_connect.cpp Sun Mar 6 15:14:07 2011
@@ -181,5 +181,10 @@
}
+tdialog* tmp_connect::mp_server_list_for_unit_test()
+{
+ return new tmp_server_list();
+}
+
} // namespace gui2
Modified: trunk/src/gui/dialogs/mp_connect.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/dialogs/mp_connect.hpp?rev=48784&r1=48783&r2=48784&view=diff
==============================================================================
--- trunk/src/gui/dialogs/mp_connect.hpp (original)
+++ trunk/src/gui/dialogs/mp_connect.hpp Sun Mar 6 15:14:07 2011
@@ -22,6 +22,8 @@
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 @@
/** 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
Modified: trunk/src/tests/gui/test_gui2.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/tests/gui/test_gui2.cpp?rev=48784&r1=48783&r2=48784&view=diff
==============================================================================
--- trunk/src/tests/gui/test_gui2.cpp (original)
+++ trunk/src/tests/gui/test_gui2.cpp Sun Mar 6 15:14:07 2011
@@ -84,7 +84,15 @@
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 @@
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 */
@@ -251,9 +259,6 @@
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());
@@ -502,6 +507,15 @@
};
template<>
+struct twrapper<gui2::tmp_server_list>
+{
+ static gui2::tdialog* create()
+ {
+ return gui2::unit_test_mp_server_list();
+ }
+};
+
+template<>
struct twrapper<gui2::ttransient_message>
{
static gui2::ttransient_message* create()
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits