8 #define BOOST_TEST_DYN_LINK
9 #define BOOST_TEST_MODULE "Test module for the ui CommitDetails class"
23 BOOST_AUTO_TEST_SUITE( uiCoreCommitDetailsSuite )
42 Qt::ItemDataRole role = Qt::DisplayRole;
44 cd.
set_option(
"Option1",
"OldVal1",
"NewVal1");
49 BOOST_CHECK( !cd.
data(QModelIndex(), Qt::DecorationRole).isValid() );
52 BOOST_CHECK_EQUAL( cd.
data( cd.
index(0, 0), role).toString().toStdString(), std::string(
"Option1") );
53 BOOST_CHECK_EQUAL( cd.
data( cd.
index(0, 1), role).toString().toStdString(), std::string(
"\"OldVal1\"") );
54 BOOST_CHECK_EQUAL( cd.
data( cd.
index(0, 2), role).toString().toStdString(), std::string(
"\"NewVal1\"") );
57 BOOST_CHECK_EQUAL( cd.
data( cd.
index(1, 0), role).toString().toStdString(), std::string(
"Option2") );
58 BOOST_CHECK_EQUAL( cd.
data( cd.
index(1, 1), role).toString().toStdString(), std::string(
"\"OldVal2\"") );
59 BOOST_CHECK_EQUAL( cd.
data( cd.
index(1, 2), role).toString().toStdString(), std::string(
"--") );
62 BOOST_CHECK_EQUAL( cd.
data( cd.
index(2, 0), role).toString().toStdString(), std::string(
"Option3") );
63 BOOST_CHECK_EQUAL( cd.
data( cd.
index(2, 1), role).toString().toStdString(), std::string(
"--") );
64 BOOST_CHECK_EQUAL( cd.
data( cd.
index(2, 2), role).toString().toStdString(), std::string(
"\"NewVal3\"") );
67 BOOST_CHECK( !cd.
data( cd.
index(0, 0), Qt::DecorationRole).isValid() );
75 Qt::ItemDataRole role = Qt::DisplayRole;
78 BOOST_CHECK_EQUAL( cd.
headerData(0, Qt::Horizontal, role).toString().toStdString(), std::string(
"Name") );
79 BOOST_CHECK_EQUAL( cd.
headerData(1, Qt::Horizontal, role).toString().toStdString(), std::string(
"Old Value") );
80 BOOST_CHECK_EQUAL( cd.
headerData(2, Qt::Horizontal, role).toString().toStdString(), std::string(
"New Value") );
83 BOOST_CHECK_EQUAL( cd.
headerData(0, Qt::Vertical, role).toString().toStdString(), std::string(
"Option #1") );
84 BOOST_CHECK_EQUAL( cd.
headerData(14, Qt::Vertical, role).toString().toStdString(), std::string(
"Option #15") );
85 BOOST_CHECK_EQUAL( cd.
headerData(8790, Qt::Vertical, role).toString().toStdString(), std::string(
"Option #8791") );
88 BOOST_CHECK( !cd.
headerData(3, Qt::Horizontal, role).isValid() );
91 BOOST_CHECK( !cd.
headerData(1, Qt::Horizontal, Qt::DecorationRole).isValid() );
100 BOOST_CHECK( !cd.
index(0, 0).isValid() );
104 QModelIndex index = cd.
index(0, 0);
108 BOOST_CHECK_EQUAL( item->
option_name().toStdString(), std::string(
"Option1") );
109 BOOST_CHECK_EQUAL( item->
old_value().toStdString(), std::string(
"OldVal") );
110 BOOST_CHECK_EQUAL( item->
current_value().toStdString(), std::string(
"NewVal") );
112 BOOST_CHECK( !cd.
index(0, 0, index).isValid() );
134 BOOST_CHECK_EQUAL( cd.
node_path().toStdString(), std::string(
"//Path/To/Node") );
148 BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(init)
QApplication * application()
bool AssertionThrows
assertions throw exceptions
bool ExceptionOutputs
if exception contructor should output
static AssertionManager & instance()
Gets the instance of the manager.
Basic Classes for client-core library used by coolfluid-client application.
bool AssertionDumps
assertions dump backtraces
Model that handles modified options details.
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
Reimplements QAbstractItemModel::headerData()
bool has_options() const
Checks whether the internal container has options.
bool ExceptionDumps
if exception contructor should dump backtrace
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
Implements QAbstractItemModel::index()
QVariant data(const QModelIndex &index, int role) const
Implements QAbstractItemModel::data()
QString old_value() const
Give the old value.
Basic item used by CommitDetails class.
void set_option(const QString &optionName, const QString &oldValue, const QString ¤tValue)
Sets a option.
QString node_path() const
Gives the node path.
QString current_value() const
Gives the current value.
Top-level namespace for coolfluid.
static ExceptionManager & instance()
Gets the instance of the manager.
QString option_name() const
Gives the option name.
void clear()
Removes all options and clears the node path.
Most basic kernel library.
bool is_not_null(T ptr)
predicate for comparison to nullptr