File: testqkeydisplaydialog.cpp

package info (click to toggle)
antimicro 3.5.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 16,532 kB
  • sloc: cpp: 50,526; makefile: 59; xml: 9
file content (84 lines) | stat: -rw-r--r-- 2,857 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/* antimicrox Gamepad to KB+M event mapper
 * Copyright (C) 2015 Travis Nickles <nickles.travis@gmail.com>
 * Copyright (C) 2020 Jagoda Górska <juliagoda.pl@protonmail>
 * Copyright (C) 2020 Paweł Kotiuk <kotiuk@zohomail.eu>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.

 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include "qkeydisplaydialog.h"

#include <QtTest/QtTest>

/*

label->text() cannot be empty
buttonBox->Close cannot be disabled
nativeTitleLabel->text() == tr("Native Key Value:")
qtKeyTitleLabel->text() == tr("Qt Key Value:")
antiTitleLabel->text() == tr("AntiMicroX Key Value:")
label->text() is all visible
label->text() contains <a href="http://doc.qt.io/qt-5/qt.html#Key-enum">
label->text() contains <a href="https://github.com/AntiMicroX/antimicrox/">
nativeKeyLabel->text() at the start is 0x00000000 or empty
qtKeyLabel->text() at the start is 0x00000000 or empty
antimicroKeyLabel->text() at the start is 0x00000000 or empty



run keyReleaseEvent(QKeyEvent *event) for all keys, that are physically present:

// qnamespace.h -> enum Key { contains all adresses of keys in Qt
// keysymdef.h and XF86keysym.h contain adresses of keys in X11
// input-event-codes.h contains addresses of keys in uinput

if int virtualkey = event->nativeVirtualKey() is != 0

if it's X11
if X11Extras::getInstance()->getGroup1KeySym(virtualkey) > 0 then check out if

if it's uinput
QtKeyMapperBase *nativeKeyMapper = AntKeyMapper::getInstance()->getNativeKeyMapper();
int tempalias = nativeKeyMapper->returnQtKey(virtualkey);
if AntKeyMapper::getInstance()->returnVirtualKey(tempalias) > 0 then check out if

ui->nativeKeyLabel->text() == QString("0x%1").arg(finalvirtual, 0, 16)
ui->qtKeyLabel->text() == QString("0x%1").arg(event->key(), 0, 16)
ui->antimicroKeyLabel->text() == QString("0x%1").arg(AntKeyMapper::getInstance()->returnQtKey(finalvirtual), 0, 16)

*/

class TestQKeyDisplayDialog: public QObject
{
    Q_OBJECT

public:
    TestQKeyDisplayDialog(QObject* parent = 0);

private slots:

private:
    QKeyDisplayDialog qkeydisplaydialog;
};

TestQKeyDisplayDialog::TestQKeyDisplayDialog(QObject* parent) :
    QObject(parent),
    QKeyDisplayDialog()
{
    QTestEventLoop::instance().enterLoop(1);
}

// QTEST_MAIN(TestQKeyDisplayDialog)
#include "testqkeydisplaydialog.moc"