QTest Namespace

  • Header: QTest

  • CMake:

    find_package(Qt6 REQUIRED COMPONENTS Test)

    target_link_libraries(mytarget PRIVATE Qt6::Test)

  • qmake: QT += testlib

Detailed Description

See the Qt Test Overview for information about how to write unit tests.

Classes

 

class QTouchEventSequence

The QTouchEventSequence class is used to simulate a sequence of touch events.

Type Documentation

 

enum QTest::KeyAction

This enum describes possible actions for key handling.

Constant

Value

Description

QTest::Press

0

The key is pressed.

QTest::Release

1

The key is released.

QTest::Click

2

The key is clicked (pressed and released).

QTest::Shortcut

3

A shortcut is activated. This value has been added in Qt 5.6.

enum QTest::MouseAction

This enum describes possible actions for mouse handling.

Constant

Value

Description

QTest::MousePress

0

A mouse button is pressed.

QTest::MouseRelease

1

A mouse button is released.

QTest::MouseClick

2

A mouse button is clicked (pressed and released).

QTest::MouseDClick

3

A mouse button is double clicked (pressed and released twice).

QTest::MouseMove

4

The mouse pointer has moved.

enum QTest::QBenchmarkMetric

This enum lists all the things that can be benchmarked.

Constant

Value

Description

QTest::FramesPerSecond

0

Frames per second

QTest::BitsPerSecond

1

Bits per second

QTest::BytesPerSecond

2

Bytes per second

QTest::WalltimeMilliseconds

3

Clock time in milliseconds

QTest::WalltimeNanoseconds

7

Clock time in nanoseconds

QTest::BytesAllocated

8

Memory usage in bytes

QTest::Events

6

Event count

QTest::CPUTicks

4

CPU time

QTest::CPUMigrations

9

Process migrations between CPUs

QTest::CPUCycles

10

CPU cycles

QTest::RefCPUCycles

30

Reference CPU cycles

QTest::BusCycles

11

Bus cycles

QTest::StalledCycles

12

Cycles stalled

QTest::InstructionReads

5

Instruction reads

QTest::Instructions

13

Instructions executed

QTest::BranchInstructions

14

Branch-type instructions

QTest::BranchMisses

15

Branch instructions that were mispredicted

QTest::CacheReferences

16

Cache accesses of any type

QTest::CacheMisses

20

Cache misses of any type

QTest::CacheReads

17

Cache reads / loads

QTest::CacheReadMisses

21

Cache read / load misses

QTest::CacheWrites

18

Cache writes / stores

QTest::CacheWriteMisses

22

Cache write / store misses

QTest::CachePrefetches

19

Cache prefetches

QTest::CachePrefetchMisses

23

Cache prefetch misses

QTest::ContextSwitches

24

Context switches