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

Namespace for all provided testing functionality helper. More...

Namespaces

namespace  hollow
 Legacy version namespace for all functionality taken over from ADTF v3.7.
 
namespace  lucky
 Legacy version namespace for all functionality taken over from ADTF v3.11.
 
namespace  mega
 Legacy version namespace for all functionality taken over from ADTF v3.12.
 
namespace  nitro
 Legacy version namespace for all functionality taken over from ADTF v3.13.
 
namespace  v0
 Namespace for all functionality provided since v1.0.
 
namespace  v2
 Namespace for all functionality provided since v1.2.
 

Classes

class  cInitQt
 A RAII utility class for automatic Qt Application initialization. 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 QTreeWidgetItem *pNode, size_t nColumnCount, QString strPrefix="")
 

Detailed Description

Namespace for all provided testing functionality helper.

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

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