ADTF Qt5
Loading...
Searching...
No Matches
adtf::ui::testing::v0 Namespace Reference

Namespace for all functionality provided since v1.0. More...

Functions

template<typename T>
T * find_qobject (const QString &strObjectName)
 
QString dump_tree (const QTreeWidgetItem *pNode, size_t nColumnCount, QString strPrefix="")
 
tResult compare_dump (const QString &strChecked, const QString &strExpected)
 
tResult wait_for_next_ui_timer (std::chrono::nanoseconds tmTimeout=std::chrono::nanoseconds{-1})
 
void schedule_in_gui_thread (std::function< void()> fnFunction)
 
tResult execute_in_gui_thread (std::function< tResult()> fnFunction, std::chrono::milliseconds tmTimeout=std::chrono::milliseconds{0})
 
tResult wait_for_next_idle (std::chrono::nanoseconds tmTimeout=std::chrono::nanoseconds{-1})
 
QAction * find_action (QMenu *pMenu, const QString &strName, bool bThrow=true)
 
void trigger_action (QAction *pAction, Qt::ConnectionType eConnectionType=Qt::BlockingQueuedConnection)
 
QString dump_tree (const QAbstractItemModel *pTree, size_t nColumnCount, const QModelIndex oNode=QModelIndex(), QString strPrefix="")
 

Detailed Description

Namespace for all functionality provided since v1.0.

Function Documentation

◆ compare_dump()

tResult adtf::ui::testing::hollow::compare_dump ( const QString & strChecked,
const QString & strExpected )

Compare to large strings.

Parameters
[in]strCheckedThe data.
[in]strExpectedThe expected data.
Returns
Standard result.

◆ dump_tree() [1/2]

QString adtf::ui::testing::nitro::dump_tree ( const QAbstractItemModel * pTree,
size_t nColumnCount,
const QModelIndex oNode = QModelIndex(),
QString strPrefix = "" )

Dumps the content of a QAbstractItemModel

Parameters
[in]pTreeThe tree widget of which the content should be dumped.
[in]nColumnCountThe amout of columns to dump, >= 2
[in]oNodeThe index from which to dump all data and children from
[in]strPrefixA prefix to all elements.
Returns
A string containing all tree data.

◆ dump_tree() [2/2]

QString adtf::ui::testing::hollow::dump_tree ( const QTreeWidgetItem * pNode,
size_t nColumnCount,
QString strPrefix = "" )

Dumps the content of a QTreeWidgetItem

Parameters
[in]pNodeThe node to dump all data and children from
[in]nColumnCountThe amout of columns to dump, >= 2
[in]strPrefixA prefix to all elements.
Returns
A string containing all tree data.

◆ execute_in_gui_thread()

tResult adtf::ui::testing::lucky::execute_in_gui_thread ( std::function< tResult()> fnFunction,
std::chrono::milliseconds tmTimeout = std::chrono::milliseconds{0} )

Execute the given function from within the GUI thread and wait until it has finished.

Parameters
[in]fnFunctionThe function that should be executed.
[in]tmTimeoutA timeout, 0 => no timeout.
Return values
ERR_TIMEOUTThe function has not been executed within the specified timeout.
tResultThe return value of the function.

◆ find_action()

QAction * adtf::ui::testing::mega::find_action ( QMenu * pMenu,
const QString & strName,
bool bThrow = true )

Finds an action within a menu

Parameters
[in]pMenuThe menu to search in.
[in]strNameThe name of the action (without '&')
[in]bThrowWhether or not to throw an exception if the action was not found.
Returns
The pointer to the action or nullptr if it was not found and bThrow is false.

◆ find_qobject()

template<typename T>
T * adtf::ui::testing::hollow::find_qobject ( const QString & strObjectName)

Utility that finds a widget/object by its object name.

Note that any QObject can have an object name. So to expose widgets to your tests give them an expressive unique name.

Parameters
[in]strObjectNameThe object name of the object/widget you're looking for.
Template Parameters
TThe type of the widget you're looking for.

◆ schedule_in_gui_thread()

void adtf::ui::testing::lucky::schedule_in_gui_thread ( std::function< void()> fnFunction)

Schedules the given function to be executed from within the GUI thread some time in the future.

Parameters
[in]fnFunctionThe function that should be executed.

◆ trigger_action()

void adtf::ui::testing::mega::trigger_action ( QAction * pAction,
Qt::ConnectionType eConnectionType = Qt::BlockingQueuedConnection )

Trigger an action within the Qt GUI thread.

Parameters
[in]pActionThe action to trigger.
[in]eConnectionTypeThe type of call.

◆ wait_for_next_idle()

tResult adtf::ui::testing::mega::wait_for_next_idle ( std::chrono::nanoseconds tmTimeout = std::chrono::nanoseconds{-1})

Wait until at least one more OnIdle() calls have been issued by the X system.

Parameters
[in]tmTimeoutAn optional timeout, -1 => no timeout.
Return values
ERR_TIMEOUTIf no OnTimer call has been issued during the timeout period.

◆ wait_for_next_ui_timer()

tResult adtf::ui::testing::hollow::wait_for_next_ui_timer ( std::chrono::nanoseconds tmTimeout = std::chrono::nanoseconds{-1})

Wait until at least one more OnTimer() call have been issued by the X system.

Parameters
[in]tmTimeoutAn optional timeout, -1 => no timeout.
Return values
ERR_TIMEOUTIf no OnTimer call has been issued during the timeout period.