7 #define BOOST_TEST_DYN_LINK
8 #define BOOST_TEST_MODULE "Test module for the GUI GraphicalString class"
11 #include <QHBoxLayout>
36 QHBoxLayout * layout =
dynamic_cast<QHBoxLayout*
>(value->layout());
37 QLineEdit * lineEdit =
nullptr;
41 lineEdit =
dynamic_cast<QLineEdit*
>(layout->itemAt(0)->widget());
44 QWARN(
"Failed to find the line edit.");
47 QWARN(
"Failed to find the layout or cast it to QHBoxLayout.");
54 BOOST_AUTO_TEST_SUITE( uiGraphicsGraphicalBoolSuite )
82 QCOMPARE( lineEdit->text().toStdString(), std::string() );
90 QCOMPARE( lineEdit->text().toStdString(), std::string(
"Hello, World!") );
108 QCOMPARE( lineEdit->text().toStdString(), std::string(
"Hello") );
111 QCOMPARE( lineEdit->text().toStdString(), std::string(
"World") );
118 QCOMPARE( lineEdit->text().toStdString(), std::string(
"12") );
121 QCOMPARE( lineEdit->text().toStdString(), std::string(
"3.141592") );
124 QCOMPARE( lineEdit->text().toStdString(), std::string(
"true") );
138 theValue = value->
value();
139 QVERIFY( theValue.type() == QVariant::String );
140 QCOMPARE( theValue.toString().toStdString(), std::string() );
143 lineEdit->setText(
"This is a sample text.");
144 theValue = value->
value();
145 QVERIFY( theValue.type() == QVariant::String );
146 QCOMPARE( theValue.toString().toStdString(), std::string(
"This is a sample text.") );
157 QSignalSpy spy(value, SIGNAL(value_changed()));
166 QCOMPARE( spy.count(), 2 );
174 QTest::keyClicks(lineEdit,
"Hello " );
175 QTest::keyClicks(lineEdit,
"World " );
176 QTest::keyClicks(lineEdit,
"And others ;)" );
179 QCOMPARE( spy.count(), 25 );
188 QCOMPARE( spy.count(), 1 );
200 QCOMPARE( value->
value_string().toStdString(), std::string(
"Hello") );
203 QCOMPARE( value->
value_string().toStdString(), std::string(
"World") );
219 lineEdit->setText(
"This is a sample text.");
223 lineEdit->setText(
"This is another one.");
233 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.
Basic Classes for Mathematical applications used by COOLFluiD.
bool AssertionDumps
assertions dump backtraces
bool ExceptionDumps
if exception contructor should dump backtrace
BOOST_AUTO_TEST_CASE(init)
virtual QVariant value() const
QLineEdit * find_line_edit(const GraphicalString *value)
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
Most basic kernel library.
bool is_not_null(T ptr)
predicate for comparison to nullptr