ADTF  3.18.3
qt_test_tools.h File Reference

Copyright © Audi Electronics Venture GmbH. More...

Go to the source code of this file.

Namespaces

 adtf
 Namespace for entire ADTF SDK.
 
 adtf::ui
 Namespace for the ADTF UI SDK.
 
 adtf::ui::testing
 Namespace for all testing functionality of the ADTF UI SDK.
 
 adtf::ui::testing::hollow
 Namespace for all functionality of the ADTF UI SDK provided since v3.7.
 
 adtf::ui::testing::lucky
 Namespace for all functionality of the ADTF UI SDK provided since v3.11.
 

Functions

template<typename T >
T * find_qobject (const QString &strObjectName)
 Utility that finds a widget/object by its object name. More...
 
QString dump_tree (const QTreeWidgetItem *pNode, size_t nColumnCount, QString strPrefix="")
 Dumps the content of a QTreeWidgetItem. More...
 
QString dump_tree (const QTreeWidget *pTree, size_t nColumnCount)
 Dump the content of a QTreeWidget. More...
 
tResult compare_dump (const QString &strChecked, const QString &strExpected)
 Compare to large strings. More...
 
tResult 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. More...
 
void 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. More...
 
tResult 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. More...
 
tResult 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. More...
 
QAction * find_action (QMenu *pMenu, const QString &strName, bool bThrow=true)
 Finds an action within a menu. More...
 
void trigger_action (QAction *pAction, Qt::ConnectionType eConnectionType=Qt::BlockingQueuedConnection)
 Trigger an action within the Qt GUI thread. More...
 
void trigger_action (const QString &strActionObjectName, Qt::ConnectionType eConnectionType=Qt::BlockingQueuedConnection)
 Trigger an action within the Qt GUI thread. More...
 
QString dump_tree (const QAbstractItemModel *pTree, size_t nColumnCount, const QModelIndex oNode=QModelIndex(), QString strPrefix="")
 Dumps the content of a QAbstractItemModel. More...
 

Detailed Description

Copyright © Audi Electronics Venture GmbH.

All rights reserved

Definition in file qt_test_tools.h.

Function Documentation

◆ dump_tree()

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.

◆ 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.

References adtf::ui::testing::mega::find_action().

Referenced by adtf::ui::testing::mega::find_action().

◆ trigger_action() [1/2]

void adtf::ui::testing::mega::trigger_action ( const QString &  strActionObjectName,
Qt::ConnectionType  eConnectionType = Qt::BlockingQueuedConnection 
)

Trigger an action within the Qt GUI thread.

Parameters
[in]strActionObjectNameThe name of the action to trigger.
[in]eConnectionTypeThe type of call.

References adtf::ui::testing::mega::trigger_action().

◆ trigger_action() [2/2]

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.

References adtf::ui::testing::mega::trigger_action().

Referenced by adtf::ui::testing::mega::trigger_action().

◆ 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.

References adtf::ui::testing::mega::wait_for_next_idle().

Referenced by adtf::ui::testing::mega::wait_for_next_idle().