Debian Codegraph @

tests/auto/input/qmouseevent/tst_qmouseevent.cpp

raw symbols SCIP
1 // Copyright (C) 2019 Klaralvdalens Datakonsult AB (KDAB).
2 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4
5 #include <QtTest/QTest>
6 #include <Qt3DInput/qmouseevent.h>
7 #include <QtGui/QMouseEvent>
8 #include <QObject>
9 #include <QSignalSpy>
10
11 class tst_QMouseEvent : public QObject
12 {
13 Q_OBJECT
14
15 private Q_SLOTS:
16 void checkModifiers()
17 {
18 {
19 // GIVEN
20 QT_PREPEND_NAMESPACE(QMouseEvent) event(QEvent::MouseButtonPress,
21 QPointF(500, 500),
22 QPointF(500, 500),
23 Qt::LeftButton,
24 Qt::LeftButton,
25 Qt::NoModifier);
26
27 // WHEN
28 Qt3DInput::QMouseEvent event3D(event);
29
30 // THEN
31 QCOMPARE(event3D.modifiers(), Qt3DInput::QMouseEvent::NoModifier);
32 }
33 {
34 // GIVEN
35 QT_PREPEND_NAMESPACE(QMouseEvent) event(QEvent::MouseButtonPress,
36 QPointF(500, 500),
37 QPointF(500, 500),
38 Qt::LeftButton,
39 Qt::LeftButton,
40 Qt::ShiftModifier);
41
42 // WHEN
43 Qt3DInput::QMouseEvent event3D(event);
44
45 // THEN
46 QCOMPARE(event3D.modifiers(), Qt3DInput::QMouseEvent::ShiftModifier);
47 }
48 {
49 // GIVEN
50 QT_PREPEND_NAMESPACE(QMouseEvent) event(QEvent::MouseButtonPress,
51 QPointF(500, 500),
52 QPointF(500, 500),
53 Qt::LeftButton,
54 Qt::LeftButton,
55 Qt::ShiftModifier|Qt::ControlModifier);
56
57 // WHEN
58 Qt3DInput::QMouseEvent event3D(event);
59
60 // THEN
61 QCOMPARE(int(event3D.modifiers()), int(Qt3DInput::QMouseEvent::ShiftModifier|Qt3DInput::QMouseEvent::ControlModifier));
62 }
63 }
64 };
65
66 QTEST_MAIN(tst_QMouseEvent)
67
68 #include "tst_qmouseevent.moc"