7 #define BOOST_TEST_DYN_LINK
8 #define BOOST_TEST_MODULE "Test module for the GUI GraphicalBool class"
11 #include <QHBoxLayout>
38 QHBoxLayout * layout =
dynamic_cast<QHBoxLayout*
>(value->layout());
39 QCheckBox * checkBox =
nullptr;
43 checkBox =
dynamic_cast<QCheckBox*
>(layout->itemAt(0)->widget());
46 std::cerr <<
"Failed to find the check box." << std::endl;
49 std::cerr <<
"Failed to find the layout or cast it to QHBoxLayout." << std::endl;
56 BOOST_AUTO_TEST_SUITE( uiGraphicsGraphicalBoolSuite )
84 BOOST_CHECK( !checkbox->isChecked() );
92 BOOST_CHECK( checkbox->isChecked() );
110 BOOST_CHECK( checkbox->isChecked() );
114 BOOST_CHECK( !checkbox->isChecked() );
121 BOOST_CHECK( checkbox->isChecked() );
123 BOOST_CHECK( value->
set_value(
"false") );
124 BOOST_CHECK( !checkbox->isChecked() );
127 BOOST_CHECK( checkbox->isChecked() );
130 BOOST_CHECK( !checkbox->isChecked() );
133 BOOST_CHECK( checkbox->isChecked() );
136 BOOST_CHECK( !checkbox->isChecked() );
139 BOOST_CHECK( !checkbox->isChecked() );
145 BOOST_CHECK( !checkbox->isChecked() );
147 BOOST_CHECK( !value->
set_value(3.141592) );
148 BOOST_CHECK( !checkbox->isChecked() );
151 BOOST_CHECK( !checkbox->isChecked() );
165 checkbox->setChecked(
true);
166 isChecked = value->
value();
167 BOOST_CHECK( isChecked.type() == QVariant::Bool );
168 BOOST_CHECK( isChecked.toBool() );
171 checkbox->setChecked(
false);
172 isChecked = value->
value();
173 BOOST_CHECK( isChecked.type() == QVariant::Bool );
174 BOOST_CHECK( !isChecked.toBool() );
185 QSignalSpy spy(value, SIGNAL(value_changed()));
194 BOOST_CHECK_EQUAL( spy.count(), 2 );
202 QTest::mouseClick(checkbox, Qt::LeftButton);
203 QTest::mouseClick(checkbox, Qt::LeftButton);
206 BOOST_CHECK_EQUAL( spy.count(), 2 );
215 BOOST_CHECK_EQUAL( spy.count(), 1 );
227 BOOST_CHECK_EQUAL( value->
value_string().toStdString(), std::string(
"true") );
230 BOOST_CHECK_EQUAL( value->
value_string().toStdString(), std::string(
"false") );
246 checkbox->setChecked(
true);
254 checkbox->setChecked(
false);
264 BOOST_AUTO_TEST_SUITE_END()
QApplication * application()
bool is_null(T ptr)
predicate for comparison to nullptr
bool AssertionThrows
assertions throw exceptions
bool ExceptionOutputs
if exception contructor should output
static AssertionManager & instance()
Gets the instance of the manager.
bool AssertionDumps
assertions dump backtraces
BOOST_AUTO_TEST_CASE(init)
bool ExceptionDumps
if exception contructor should dump backtrace
Conversions from and to std::string.
Uniform Resource Identifier (see http://en.wikipedia.org/wiki/Uniform_Resource_Identifier) ...
virtual QVariant value() const
Top-level namespace for coolfluid.
virtual bool set_value(const QVariant &value)
static ExceptionManager & instance()
Gets the instance of the manager.
Basic Classes for Graphics applications used by CF.
QString value_string() const
QCheckBox * find_check_box(const GraphicalBool *value)
Most basic kernel library.
bool is_not_null(T ptr)
predicate for comparison to nullptr
QVariant original_value() const