QtPass 1.4.0
Multi-platform GUI for pass, the standard unix password manager.
Loading...
Searching...
No Matches
tst_ui.cpp
Go to the documentation of this file.
1#include "../../../src/passworddialog.h"
3#include <QCoreApplication>
4#include <QtTest>
5
9class tst_ui : public QObject {
10 Q_OBJECT
11
12private Q_SLOTS:
13 void contentRemainsSame();
14};
15
21void tst_ui::contentRemainsSame() {
22 QScopedPointer<PasswordDialog> d(
24 d->setTemplate("", false);
25 QString input = "pw\n";
26 d->setPass(input);
27 QCOMPARE(d->getPassword(), input);
28
29 d.reset(new PasswordDialog(PasswordConfiguration{}, nullptr));
30 input = "pw\nname: value\n";
31 d->setPass(input);
32 QCOMPARE(d->getPassword(), input);
33
34 d.reset(new PasswordDialog(PasswordConfiguration{}, nullptr));
35 d->setTemplate("name", false);
36 d->setPass(input);
37 QCOMPARE(d->getPassword(), input);
38
39 d.reset(new PasswordDialog(PasswordConfiguration{}, nullptr));
40 d->setTemplate("name", true);
41 d->setPass(input);
42 QCOMPARE(d->getPassword(), input);
43
44 d.reset(new PasswordDialog(PasswordConfiguration{}, nullptr));
45 d->setTemplate("", false);
46 d->templateAll(true);
47 d->setPass(input);
48 QCOMPARE(d->getPassword(), input);
49
50 d.reset(new PasswordDialog(PasswordConfiguration{}, nullptr));
51 d->setTemplate("", true);
52 d->templateAll(true);
53 d->setPass(input);
54 QCOMPARE(d->getPassword(), input);
55
56 d.reset(new PasswordDialog(PasswordConfiguration{}, nullptr));
57 d->setTemplate("name", true);
58 d->templateAll(true);
59 d->setPass(input);
60 QCOMPARE(d->getPassword(), input);
61}
62
63QTEST_MAIN(tst_ui)
64#include "tst_ui.moc"
PasswordDialog Handles the inserting and editing of passwords.
The tst_ui class is our first unit test.
Definition: tst_ui.cpp:9
Holds the Password configuration settings.