on xenial help sign in
Remove some no-longer-used files
commit5b98027d244765ea4551804d38c3e36d1a4c84f4 authorMichael Terry <michael.terry@canonical.com> dateThu 8 Sep 2016, 16:02 (10 years ago) parentc488c56
6 files changed−520
tests/mocks/liblightdm/GreeterPrivate.cpp−132 tests/mocks/liblightdm/GreeterPrivate.h−54 tests/mocks/liblightdm/SessionsModelPrivate.cpp−83 tests/mocks/liblightdm/SessionsModelPrivate.h−63 tests/mocks/liblightdm/UsersModelPrivate.cpp−124 tests/mocks/liblightdm/UsersModelPrivate.h−64
tests/mocks/liblightdm/GreeterPrivate.cppdeleted−132
@@ -1,132 +0,0 @@
1−/*
2− * Copyright (C) 2014 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−#include "Greeter.h"
18−#include "GreeterPrivate.h"
19−
20−namespace QLightDM
21−{
22−
23−GreeterPrivate::GreeterPrivate(Greeter* parent)
24− : authenticated(false),
25− authenticationUser(),
26− twoFactorDone(false),
27− mockMode("single"),
28− q_ptr(parent)
29−{
30− char *envMockMode = getenv("LIBLIGHTDM_MOCK_MODE");
31− if (envMockMode) {
32− mockMode = envMockMode;
33− }
34−}
35−
36−void GreeterPrivate::handleAuthenticate()
37−{
38− Q_Q(Greeter);
39−
40− if (mockMode == "single") {
41− authenticated = true;
42− Q_EMIT q->authenticationComplete();
43− } else if (mockMode == "single-passphrase" || mockMode == "single-pin") {
44− Q_EMIT q->showPrompt("Password: ", Greeter::PromptTypeSecret);
45− } else if (mockMode == "full") {
46− handleAuthenticate_full();
47− }
48−}
49−
50−void GreeterPrivate::handleAuthenticate_full()
51−{
52− Q_Q(Greeter);
53−
54− // Send out any messages we need to
55− if (authenticationUser == "info-prompt")
56− Q_EMIT q->showMessage("Welcome to Unity Greeter", Greeter::MessageTypeInfo);
57− else if (authenticationUser == "wide-info-prompt")
58− Q_EMIT q->showMessage("Welcome to Unity Greeter, the greeteriest greeter that ever did appear in these fine lands", Greeter::MessageTypeInfo);
59− else if (authenticationUser == "html-info-prompt")
60− Q_EMIT q->showMessage("<b>&</b>", Greeter::MessageTypeInfo);
61− else if (authenticationUser == "long-info-prompt")
62− Q_EMIT q->showMessage("Welcome to Unity Greeter\n\nWe like to annoy you with super ridiculously long messages.\nLike this one\n\nThis is the last line of a multiple line message.", Greeter::MessageTypeInfo);
63− else if (authenticationUser == "multi-info-prompt") {
64− Q_EMIT q->showMessage("Welcome to Unity Greeter", Greeter::MessageTypeInfo);
65− Q_EMIT q->showMessage("This is an error", Greeter::MessageTypeError);
66− Q_EMIT q->showMessage("You should have seen three messages", Greeter::MessageTypeInfo);
67− }
68−
69− // OK, now actually do the prompt
70− if (authenticationUser == "no-password") {
71− authenticated = true;
72− Q_EMIT q->authenticationComplete();
73− } else if (authenticationUser == "has-pin"){
74− Q_EMIT q->showPrompt("Password: ", Greeter::PromptTypeSecret);
75− } else if (authenticationUser == "auth-error") {
76− authenticated = false;
77− Q_EMIT q->authenticationComplete();
78− } else if (authenticationUser == "different-prompt") {
79− Q_EMIT q->showPrompt("Secret word: ", Greeter::PromptTypeSecret);
80− } else {
81− Q_EMIT q->showPrompt("Password: ", Greeter::PromptTypeSecret);
82− }
83−}
84−
85−void GreeterPrivate::handleRespond(QString const &response)
86−{
87− Q_Q(Greeter);
88−
89− if (mockMode == "single") {
90− // NOOP
91− } else if (mockMode == "single-passphrase") {
92− authenticated = (response == "password");
93− q->sendAuthenticationComplete();
94− } else if (mockMode == "single-pin") {
95− authenticated = (response == "1234");
96− q->sendAuthenticationComplete();
97− } else if (mockMode == "full") {
98− handleRespond_full(response);
99− }
100−}
101−
102−void GreeterPrivate::handleRespond_full(const QString &response)
103−{
104− Q_Q(Greeter);
105−
106− if (authenticationUser == "no-response")
107− return;
108− else if (authenticationUser == "two-factor") {
109− if (!twoFactorDone) {
110− if (response == "password") {
111− twoFactorDone = true;
112− Q_EMIT q->showPrompt("otp", Greeter::PromptTypeQuestion);
113− } else {
114− authenticated = false;
115− q->sendAuthenticationComplete();
116− }
117− } else {
118− authenticated = (response == "otp");
119− q->sendAuthenticationComplete();
120− }
121− return;
122− }
123−
124− if (authenticationUser == "has-pin") {
125− authenticated = (response == "1234");
126− } else {
127− authenticated = (response == "password");
128− }
129− q->sendAuthenticationComplete();
130−}
131−
132−}
tests/mocks/liblightdm/GreeterPrivate.hdeleted−54
@@ -1,54 +0,0 @@
1−/*
2− * Copyright (C) 2014 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−#ifndef UNITY_MOCK_GREETER_PRIVATE_H
18−#define UNITY_MOCK_GREETER_PRIVATE_H
19−
20−#include <QtCore/QObject>
21−
22−namespace QLightDM
23−{
24−class Greeter;
25−class GreeterImpl;
26−
27−class GreeterPrivate
28−{
29−public:
30− explicit GreeterPrivate(Greeter* parent=0);
31− virtual ~GreeterPrivate() = default;
32−
33− // These variables may not be used by all subclasses, that's no problem
34− bool authenticated;
35− QString authenticationUser;
36− bool twoFactorDone;
37− QString selectUserHint;
38−
39− QString mockMode;
40−
41− void handleAuthenticate();
42− void handleRespond(const QString &response);
43−
44−protected:
45− Greeter * const q_ptr;
46−
47−private:
48− void handleAuthenticate_full();
49− void handleRespond_full(const QString &response);
50− Q_DECLARE_PUBLIC(Greeter)
51−};
52−}
53−
54−#endif // UNITY_MOCK_GREETER_PRIVATE_H
tests/mocks/liblightdm/SessionsModelPrivate.cppdeleted−83
@@ -1,83 +0,0 @@
1−/*
2− * Copyright (C) 2015 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−#include "SessionsModel.h"
18−#include "SessionsModelPrivate.h"
19−#include <QDebug>
20−namespace QLightDM
21−{
22−
23−SessionsModelPrivate::SessionsModelPrivate(SessionsModel* parent)
24− : testScenario("singleSession")
25− , m_availableSessions(
26− {
27− {"ubuntu", "", "Ubuntu", ""},
28− {"ubuntu-2d", "", "Ubuntu 2D", ""},
29− {"gnome", "", "GNOME", ""},
30− {"gnome-classic", "", "GNOME Classic", ""},
31− {"gnome-flashback-compiz", "", "GNOME Flashback (Compiz)", ""},
32− {"gnome-flashback-metacity", "", "GNOME Flashback (Metacity)", ""},
33− {"gnome-wayland", "", "GNOME on Wayland", ""},
34− {"plasma", "", "Plasma", ""},
35− {"kde", "", "KDE" , ""},
36− {"xterm", "", "Recovery Console", ""},
37− {"", "", "Unknown?", ""}
38− })
39− , q_ptr(parent)
40−{
41− numSessions = numAvailableSessions();
42− resetEntries();
43−}
44−
45−int SessionsModelPrivate::numAvailableSessions() const
46−{
47− return m_availableSessions.length();
48−}
49−
50−void SessionsModelPrivate::resetEntries()
51−{
52− Q_Q(SessionsModel);
53−
54− q->beginResetModel();
55− if (testScenario == "multipleSessions") {
56− resetEntries_multipleSessions(numSessions);
57− } else if (testScenario == "noSessions") {
58− resetEntries_noSessions();
59− } else {
60− resetEntries_singleSession();
61− }
62− q->endResetModel();
63−}
64−
65−void SessionsModelPrivate::resetEntries_multipleSessions(int numSessions)
66−{
67− sessionItems.clear();
68− for (int i = 0; i < numSessions; i++) {
69− sessionItems.append(m_availableSessions.value(i));
70− }
71−}
72−
73−void SessionsModelPrivate::resetEntries_noSessions()
74−{
75− sessionItems = {};
76−}
77−
78−void SessionsModelPrivate::resetEntries_singleSession()
79−{
80− sessionItems = {{"ubuntu", "", "Ubuntu", ""}};
81−}
82−
83−} // namespace QLightDM
tests/mocks/liblightdm/SessionsModelPrivate.hdeleted−63
@@ -1,63 +0,0 @@
1−/*
2− * Copyright (C) 2015 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− */
17−
18−#ifndef UNITY_MOCK_SESSIONSMODEL_PRIVATE_H
19−#define UNITY_MOCK_SESSIONSMODEL_PRIVATE_H
20−
21−#include <QtCore/QList>
22−#include <QtCore/QString>
23−
24−namespace QLightDM
25−{
26−class SessionsModel;
27−
28−class SessionItem
29−{
30−public:
31− QString key;
32− QString type; // unused
33− QString name;
34− QString comment; // unused
35−};
36−
37−class SessionsModelPrivate
38−{
39−public:
40− explicit SessionsModelPrivate(SessionsModel* parent=0);
41− virtual ~SessionsModelPrivate() = default;
42−
43− int numAvailableSessions() const;
44−
45− QList<SessionItem> sessionItems;
46− int numSessions;
47− QString testScenario;
48−
49− void resetEntries();
50−protected:
51− SessionsModel* const q_ptr;
52−
53−private:
54− const QList<SessionItem> m_availableSessions;
55− void resetEntries_multipleSessions(int numSessions);
56− void resetEntries_noSessions();
57− void resetEntries_singleSession();
58− Q_DECLARE_PUBLIC(SessionsModel)
59−};
60−
61−} // namespace QLightDM
62−
63−#endif // UNITY_MOCK_SESSIONSMODEL_PRIVATE_H
tests/mocks/liblightdm/UsersModelPrivate.cppdeleted−124
@@ -1,124 +0,0 @@
1−/*
2− * Copyright (C) 2014-2016 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−#include "UsersModelPrivate.h"
18−#include "UsersModel.h"
19−
20−#include <QDir>
21−
22−namespace QLightDM
23−{
24−
25−UsersModelPrivate::UsersModelPrivate(UsersModel* parent)
26− : mockMode("single")
27− , q_ptr(parent)
28−{
29− char *envMockMode = getenv("LIBLIGHTDM_MOCK_MODE");
30− if (envMockMode) {
31− mockMode = envMockMode;
32− }
33− resetEntries();
34−}
35−
36−void UsersModelPrivate::resetEntries()
37−{
38− Q_Q(UsersModel);
39−
40− q->beginResetModel();
41−
42− if (mockMode == "single") {
43− resetEntries_single();
44− } else if (mockMode == "single-passphrase") {
45− resetEntries_singlePassphrase();
46− } else if (mockMode == "single-pin") {
47− resetEntries_singlePin();
48− } else if (mockMode == "full") {
49− resetEntries_full();
50− }
51−
52− // Assign uids in a loop, just to avoid having to muck with them when
53− // adding or removing test users.
54− for (int i = 0; i < entries.size(); i++) {
55− entries[i].uid = i + 1;
56− }
57−
58− // Assign backgrounds
59− QDir backgroundDir("/usr/share/backgrounds");
60− QStringList backgrounds = backgroundDir.entryList(QDir::Files);
61− if (!backgrounds.empty()) {
62− for (int i = 0; i < entries.size(); i++) {
63− if (entries[i].background.isNull()) {
64− entries[i].background = backgroundDir.filePath(backgrounds[i % backgrounds.size()]);
65− }
66− }
67− }
68−
69− q->endResetModel();
70−}
71−
72−void UsersModelPrivate::resetEntries_single()
73−{
74− entries =
75− {
76− { "single", "Single User", 0, 0, false, false, "ubuntu", 0 },
77− };
78−}
79−
80−void UsersModelPrivate::resetEntries_singlePassphrase()
81−{
82− entries =
83− {
84− { "single", "Single User", 0, 0, false, false, "ubuntu", 0 },
85− };
86−}
87−
88−void UsersModelPrivate::resetEntries_singlePin()
89−{
90− entries =
91− {
92− { "has-pin", "Has PIN", 0, 0, false, false, "ubuntu", 0 },
93− };
94−}
95−
96−void UsersModelPrivate::resetEntries_full()
97−{
98− entries =
99− {
100− { "has-password", "Has Password", 0, 0, false, false, "ubuntu", 0 },
101− { "has-pin", "Has PIN", 0, 0, false, false, "ubuntu", 0 },
102− { "different-prompt", "Different Prompt", 0, 0, false, false, "ubuntu", 0 },
103− { "no-password", "No Password", 0, 0, false, false, "ubuntu", 0 },
104− { "auth-error", "Auth Error", 0, 0, false, false, "ubuntu", 0 },
105− { "two-factor", "Two Factor", 0, 0, false, false, "ubuntu", 0 },
106− { "info-prompt", "Info Prompt", 0, 0, false, false, "ubuntu", 0 },
107− { "html-info-prompt", "HTML Info Prompt", 0, 0, false, false, "ubuntu", 0 },
108− { "long-info-prompt", "Long Info Prompt", 0, 0, false, false, "ubuntu", 0 },
109− { "wide-info-prompt", "Wide Info Prompt", 0, 0, false, false, "ubuntu", 0 },
110− { "multi-info-prompt", "Multi Info Prompt", 0, 0, false, false, "ubuntu", 0 },
111− { "long-name", "Long name (far far too long to fit, seriously this would never fit on the screen, you will never see this part of the name)", 0, 0, false, false, "ubuntu", 0 },
112− { "color-background", "Color Background", "#E95420", 0, false, false, "ubuntu", 0 },
113− // white and black are a bit redundant, but useful for manually testing if UI is still readable
114− { "white-background", "White Background", "#ffffff", 0, false, false, "ubuntu", 0 },
115− { "black-background", "Black Background", "#000000", 0, false, false, "ubuntu", 0 },
116− { "no-background", "No Background", "", 0, false, false, "ubuntu", 0 },
117− { "unicode", "가나다라마", 0, 0, false, false, "ubuntu", 0 },
118− { "no-response", "No Response", 0, 0, false, false, "ubuntu", 0 },
119− { "empty-name", "", 0, 0, false, false, "ubuntu", 0 },
120− { "active", "Active Account", 0, 0, true, false, "ubuntu", 0 },
121− };
122−}
123−
124−} // namespace QLightDM
tests/mocks/liblightdm/UsersModelPrivate.hdeleted−64
@@ -1,64 +0,0 @@
1−/*
2− * Copyright (C) 2014-2016 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−#ifndef UNITY_MOCK_USERSMODEL_PRIVATE_H
18−#define UNITY_MOCK_USERSMODEL_PRIVATE_H
19−
20−#include <QtCore/QList>
21−#include <QtCore/QString>
22−
23−namespace QLightDM
24−{
25−class UsersModel;
26−
27−class Entry
28−{
29−public:
30− QString username;
31− QString real_name;
32− QString background;
33− QString layouts;
34− bool is_active;
35− bool has_messages;
36− QString session;
37− QString infographic;
38− uid_t uid;
39−};
40−
41−class UsersModelPrivate
42−{
43−public:
44− explicit UsersModelPrivate(UsersModel *parent = 0);
45− virtual ~UsersModelPrivate() = default;
46−
47− QList<Entry> entries;
48− QString mockMode;
49−
50− void resetEntries();
51−protected:
52− UsersModel * const q_ptr;
53−
54−private:
55− void resetEntries_single();
56− void resetEntries_singlePassphrase();
57− void resetEntries_singlePin();
58− void resetEntries_full();
59− Q_DECLARE_PUBLIC(UsersModel)
60−};
61−
62−}
63−
64−#endif // UNITY_MOCK_USERSMODEL_PRIVATE_H