7 #define BOOST_TEST_DYN_LINK
8 #define BOOST_TEST_MODULE "Test module for the GUI GraphicalInt class with unsigned int values"
10 #include <QDoubleSpinBox>
11 #include <QHBoxLayout>
36 QHBoxLayout * layout =
dynamic_cast<QHBoxLayout*
>(value->layout());
37 QDoubleSpinBox * spin_box =
nullptr;
41 spin_box =
dynamic_cast<QDoubleSpinBox*
>(layout->itemAt(0)->widget());
44 std::cerr <<
"Failed to find the spin box." << std::endl;
47 std::cerr <<
"Failed to find the layout or cast it to QHBoxLayout." << std::endl;
54 BOOST_AUTO_TEST_SUITE( uiGraphicsGraphicalBoolSuite )
87 BOOST_CHECK_EQUAL(
Uint(spin_box->value()), 0 );
95 BOOST_CHECK_EQUAL(
int(spin_box->value()), 1456 );
113 BOOST_CHECK_EQUAL(
Uint(spin_box->value()),
Uint(1456) );
116 BOOST_CHECK_EQUAL(
Uint(spin_box->value()),
Uint(215468548) );
121 BOOST_CHECK( !value->
set_value(3.141592) );
122 BOOST_CHECK_EQUAL(
Uint(spin_box->value()),
Uint(215468548) );
125 BOOST_CHECK_EQUAL(
Uint(spin_box->value()),
Uint(215468548) );
127 BOOST_CHECK( !value->
set_value(
"789654123") );
128 BOOST_CHECK_EQUAL(
Uint(spin_box->value()),
Uint(215468548) );
142 theValue = value->
value();
143 BOOST_CHECK( theValue.type() == QVariant::UInt );
144 BOOST_CHECK_EQUAL( theValue.toUInt(), 0 );
147 spin_box->setValue(488654);
148 theValue = value->
value();
149 BOOST_CHECK( theValue.type() == QVariant::UInt );
150 BOOST_CHECK_EQUAL( theValue.toUInt(), 488654 );
161 QSignalSpy spy(value, SIGNAL(value_changed()));
170 BOOST_CHECK_EQUAL( spy.count(), 1 );
179 QTest::keyClicks(spin_box,
"+2014" );
180 QTest::keyClicks(spin_box,
"357" );
181 QTest::keyClicks(spin_box,
"aq45s2" );
185 BOOST_CHECK_EQUAL( spy.count(), 10 );
194 BOOST_CHECK_EQUAL( spy.count(), 1 );
206 BOOST_CHECK_EQUAL( value->
value_string().toStdString(), std::string(
"78646") );
209 BOOST_CHECK_EQUAL( value->
value_string().toStdString(), std::string(
"165464") );
225 spin_box->setValue(123464);
229 spin_box->setValue(65454354);
235 spin_box->setValue(65454354);
243 BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(init)
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
QDoubleSpinBox * find_spin_box(const GraphicalInt *value)
bool ExceptionDumps
if exception contructor should dump backtrace
virtual QVariant value() const
virtual bool set_value(const QVariant &value)
Uint uint_min()
Definition of the minimum number representable with the chosen precision.
Top-level namespace for coolfluid.
static ExceptionManager & instance()
Gets the instance of the manager.
Uint uint_max()
Returns the maximum number representable with the chosen precision.
Basic Classes for Graphics applications used by CF.
unsigned int Uint
typedef for unsigned int
QString value_string() const
Most basic kernel library.
bool is_not_null(T ptr)
predicate for comparison to nullptr