16 #define GETTEXT_DOMAIN "wesnoth-lib"
18 #include <boost/test/unit_test.hpp>
44 static const std::string result =
45 "At '0'. Iterate widget: reached the end. Iterate grid: failed. "
46 "Iterate child: proceed. Down and visit '1'.\n"
47 "At '1'. Iterate widget: reached the end. Iterate grid: failed. "
48 "Iterate child: proceed. Down and visit '5'.\n"
49 "At '5'. Iterate widget: reached the end. Iterate grid: failed. "
50 "Iterate child: reached the end. Up widget '5'. "
51 "Iterate: reached '6'. Down and visit '6'.\n"
52 "At '6'. Iterate widget: reached the end. Iterate grid: failed. "
53 "Iterate child: reached the end. Up widget '6'. "
54 "Iterate: reached '7'. Down and visit '7'.\n"
55 "At '7'. Iterate widget: reached the end. Iterate grid: failed. "
56 "Iterate child: reached the end. Up widget '7'. "
57 "Iterate: reached '8'. Down and visit '8'.\n"
58 "At '8'. Iterate widget: reached the end. Iterate grid: failed. "
59 "Iterate child: reached the end. Up widget '8'. "
60 "Iterate: failed. Up widget '1'. "
61 "Iterate: reached '2'. Down and visit '2'.\n"
62 "At '2'. Iterate widget: reached the end. Iterate grid: failed. "
63 "Iterate child: reached the end. Up widget '2'. "
64 "Iterate: reached '3'. Down and visit '3'.\n"
65 "At '3'. Iterate widget: reached the end. Iterate grid: failed. "
66 "Iterate child: reached the end. Up widget '3'. "
67 "Iterate: reached '4'. Down and visit '4'.\n"
68 "At '4'. Iterate widget: reached the end. Iterate grid: failed. "
69 "Iterate child: reached the end. Up widget '4'. "
70 "Iterate: failed. Finished iteration.\n";
77 static const std::string result =
78 "Constructor: Down widget '1'. Down widget '5'. Finished at '5'.\n"
79 "At '5'. Iterate widget: reached the end. Iterate grid: failed. "
80 "Iterate child: Up '1'. Iterate child: visit '1'. "
81 "Down widget '6'. Visit '6'.\n"
82 "At '6'. Iterate widget: reached the end. Iterate grid: failed. "
83 "Iterate child: Up '1'. Iterate child: visit '1'. "
84 "Down widget '7'. Visit '7'.\n"
85 "At '7'. Iterate widget: reached the end. Iterate grid: failed. "
86 "Iterate child: Up '1'. Iterate child: visit '1'. "
87 "Down widget '8'. Visit '8'.\n"
88 "At '8'. Iterate widget: reached the end. Iterate grid: failed. "
89 "Iterate child: Up '1'. Iterate child: reached the end. Visit '1'.\n"
90 "At '1'. Iterate widget: reached the end. Iterate grid: failed. "
91 "Iterate child: Up '0'. Iterate child: visit '0'. "
92 "Down widget '2'. Visit '2'.\n"
93 "At '2'. Iterate widget: reached the end. Iterate grid: failed. "
94 "Iterate child: Up '0'. Iterate child: visit '0'. "
95 "Down widget '3'. Visit '3'.\n"
96 "At '3'. Iterate widget: reached the end. Iterate grid: failed. "
97 "Iterate child: Up '0'. Iterate child: visit '0'. "
98 "Down widget '4'. Visit '4'.\n"
99 "At '4'. Iterate widget: reached the end. Iterate grid: failed. "
100 "Iterate child: Up '0'. Iterate child: reached the end. Visit '0'.\n"
101 "At '0'. Iterate widget: reached the end. Iterate grid: failed. "
102 "Iterate child: Finished iteration.\n";
108 , std::unique_ptr<gui2::widget> widget
109 ,
const std::string&
id
111 ,
const unsigned column)
113 BOOST_REQUIRE_NE(widget.get(),
static_cast<gui2::widget*
>(
nullptr));
136 BOOST_CHECK_EQUAL(
iterator.at_end(),
false);
138 BOOST_CHECK_EQUAL(&*
iterator, &control);
142 BOOST_CHECK_EQUAL(
iterator.next(),
false);
144 BOOST_CHECK_EQUAL(
iterator.at_end(),
true);
156 BOOST_CHECK_EQUAL(
iterator.at_end(),
true);
161 BOOST_CHECK_EQUAL(
iterator.at_end(),
false);
165 BOOST_CHECK_EQUAL(
iterator.at_end(),
true);
185 auto g = std::make_unique<gui2::grid>(2, 2);
199 std::stringstream sstr;
215 std::stringstream sstr;
231 std::stringstream sstr;
247 std::stringstream sstr;
276 std::stringstream sstr;
A config object defines a single node in a WML file, with access to child nodes.
Singleton class to manage game config file caching.
void add_define(const std::string &define)
Add a entry to preproc defines map.
static config_cache & instance()
Get reference to the singleton object.
void clear_defines()
Clear stored defines map to default values.
static const unsigned HORIZONTAL_GROW_SEND_TO_CLIENT
static const unsigned VERTICAL_GROW_SEND_TO_CLIENT
void set_child(std::unique_ptr< widget > widget, const unsigned row, const unsigned col, const unsigned flags, const unsigned border_size)
Sets a child in the grid.
Helper class to redirect the output of the logger in a certain scope.
Definitions for the interface to Wesnoth Markup Language (WML).
Contains the base iterator class for the gui2 widgets.
bool set_log_domain_severity(const std::string &name, severity severity)
std::string::const_iterator iterator
static std::string bottom_up_t_t_t_result()
static void test_control(T &&control)
static void add_widget(gui2::grid &grid, std::unique_ptr< gui2::widget > widget, const std::string &id, const unsigned row, const unsigned column)
static std::string top_down_t_t_t_result()
BOOST_AUTO_TEST_CASE(test_gui2_iterator)