on xenial help sign in
Rename Fingerprints to Biometryd
0e9b78aMichael Terry
debian/control+1
@@ -96,6 +96,7 @@ Architecture: any
96Provides: indicator-renderer,
96Provides: indicator-renderer,
97Depends: dmz-cursor-theme,
97Depends: dmz-cursor-theme,
98 gsettings-desktop-schemas,
98 gsettings-desktop-schemas,
99+ libbiometryd1,
99 libcap2-bin,
100 libcap2-bin,
100 libglib2.0-bin,
101 libglib2.0-bin,
101 qmenumodel-qml (>= 0.2.9),
102 qmenumodel-qml (>= 0.2.9),
qml/Greeter/Greeter.qml+7−6
@@ -16,9 +16,9 @@
16
16
17import QtQuick 2.4
17import QtQuick 2.4
18import AccountsService 0.1
18import AccountsService 0.1
19+import Biometryd 0.0 as Biometryd
19import GSettings 1.0
20import GSettings 1.0
20import Ubuntu.Components 1.3
21import Ubuntu.Components 1.3
21−import Ubuntu.Fingerprints 0.1
22import Ubuntu.SystemImage 0.1
22import Ubuntu.SystemImage 0.1
23import Unity.Launcher 0.1
23import Unity.Launcher 0.1
24import Unity.Session 0.1
24import Unity.Session 0.1
@@ -481,14 +481,15 @@ Showable {
481 onLanguageChanged: lightDM.infographic.readyForDataChange()
481 onLanguageChanged: lightDM.infographic.readyForDataChange()
482 }
482 }
483
483
484− Connections {
484+ Biometryd.Observer {
485− target: Fingerprints
485+ objectName: "biometryd"
486− onIdentificationCompleted: {
486+ onSucceeded: {
487− // FIXME validate uid
487+ // FIXME validate result.uid
488+ d.fingerprintFailureCount = 0;
488 if (root.active)
489 if (root.active)
489 root.forcedUnlock = true;
490 root.forcedUnlock = true;
490 }
491 }
491− onIdentificationFailed: {
492+ onFailed: {
492 d.fingerprintFailureCount++;
493 d.fingerprintFailureCount++;
493 if (loader.item)
494 if (loader.item)
494 loader.item.showErrorMessage(i18n.tr("Try again"));
495 loader.item.showErrorMessage(i18n.tr("Try again"));
tests/mocks/Biometryd/Biometryd.qmltypesnew file+30
@@ -0,0 +1,30 @@
1+import QtQuick.tooling 1.2
2+
3+// This file describes the plugin-supplied types contained in the library.
4+// It is used for QML tooling purposes only.
5+//
6+// This file was auto-generated by:
7+// 'qmlplugindump -notrelocatable Biometryd 0.0 tests/mocks'
8+
9+Module {
10+ dependencies: []
11+ Component {
12+ name: "MockObserver"
13+ prototype: "QObject"
14+ exports: ["Biometryd/Observer 0.0"]
15+ exportMetaObjectRevisions: [0]
16+ Signal {
17+ name: "succeeded"
18+ Parameter { name: "result"; type: "QVariant" }
19+ }
20+ Signal {
21+ name: "failed"
22+ Parameter { name: "reason"; type: "string" }
23+ }
24+ Method {
25+ name: "mockIdentification"
26+ Parameter { name: "uid"; type: "int" }
27+ Parameter { name: "error"; type: "string" }
28+ }
29+ }
30+}
tests/mocks/Biometryd/CMakeLists.txtnew file+14
@@ -0,0 +1,14 @@
1+include_directories(
2+ ${CMAKE_CURRENT_BINARY_DIR}
3+)
4+
5+set(MOCK_BIOMETRYD_SOURCES
6+ plugin.cpp
7+ MockObserver.cpp
8+)
9+
10+add_library(MockBiometryd MODULE ${MOCK_BIOMETRYD_SOURCES})
11+
12+qt5_use_modules(MockBiometryd Qml Quick Core)
13+
14+add_unity8_mock(Biometryd 0.0 Biometryd TARGETS MockBiometryd)
tests/mocks/Ubuntu/Fingerprints/MockFingerprints.h → tests/mocks/Biometryd/MockObserver.cpprenamed+23−18
@@ -14,30 +14,35 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
15 */
16
16
17−#ifndef MOCK_FINGERPRINTS_H
17+#include "MockObserver.h"
18−#define MOCK_FINGERPRINTS_H
19
18
20−#include <QObject>
21−
22−class MockFingerprints : public QObject
19+class Result : public QObject
23{
20{
24 Q_OBJECT
21 Q_OBJECT
25− Q_DISABLE_COPY(MockFingerprints)
22+ Q_PROPERTY(unsigned int uid READ uid CONSTANT)
26− Q_ENUMS(IdentificationError)
27
23
28public:
24public:
29− enum IdentificationError {
30− None,
31− Error,
32− };
33−
34− explicit MockFingerprints(QObject *parent = 0);
25+ explicit Result(unsigned int uid, QObject *parent = 0)
26+ : QObject(parent), m_uid(uid)
27+ {}
35
28
36− Q_INVOKABLE void mockIdentification(int uid, IdentificationError error); // only in mock
29+ unsigned int uid() const { return m_uid; }
37
30
38−Q_SIGNALS:
31+private:
39− void identificationCompleted(int uid);
32+ unsigned int m_uid;
40− void identificationFailed(IdentificationError);
41};
33};
42
34
43−#endif // MOCK_FINGERPRINTS_H
35+MockObserver::MockObserver(QObject *parent)
36+ : QObject(parent)
37+{
38+}
39+
40+void MockObserver::mockIdentification(int uid, const QString &error)
41+{
42+ if (error.isEmpty())
43+ Q_EMIT succeeded(QVariant::fromValue(new Result(uid, this)));
44+ else
45+ Q_EMIT failed(error);
46+}
47+
48+#include "MockObserver.moc"
tests/mocks/Ubuntu/Fingerprints/MockFingerprints.cpp → tests/mocks/Biometryd/MockObserver.hrenamed+20−11
@@ -14,17 +14,26 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
15 */
16
16
17−#include "MockFingerprints.h"
17+#ifndef MOCK_OBSERVER_H
18+#define MOCK_OBSERVER_H
18
19
19−MockFingerprints::MockFingerprints(QObject *parent)
20− : QObject(parent)
20+#include <QObject>
21−{
21+#include <QString>
22−}
22+#include <QVariant>
23
23
24−void MockFingerprints::mockIdentification(int uid, IdentificationError error)
24+class MockObserver : public QObject
25{
25{
26− if (error != None)
26+ Q_OBJECT
27− Q_EMIT identificationFailed(error);
27+ Q_DISABLE_COPY(MockObserver)
28− else
28+
29− Q_EMIT identificationCompleted(uid);
29+public:
30+ explicit MockObserver(QObject *parent = 0);
31+
32+ Q_INVOKABLE void mockIdentification(int uid, const QString &error); // only in mock
33+
34+Q_SIGNALS:
35+ void succeeded(const QVariant &result);
36+ void failed(const QString &reason);
30−}
37+};
38+
39+#endif // MOCK_OBSERVER_H
tests/mocks/Ubuntu/Fingerprints/plugin.cpp → tests/mocks/Biometryd/plugin.cpprenamed+3−10
@@ -15,20 +15,13 @@
15 */
15 */
16
16
17#include "plugin.h"
17#include "plugin.h"
18−#include "MockFingerprints.h"
18+#include "MockObserver.h"
19
19
20#include <QtQml>
20#include <QtQml>
21
21
22−static QObject *service_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
23−{
24− Q_UNUSED(engine)
25− Q_UNUSED(scriptEngine)
26− return new MockFingerprints();
27−}
28−
29void BackendPlugin::registerTypes(const char *uri)
22void BackendPlugin::registerTypes(const char *uri)
30{
23{
31− Q_ASSERT(uri == QLatin1String("Ubuntu.Fingerprints"));
24+ Q_ASSERT(uri == QLatin1String("Biometryd"));
32
25
33− qmlRegisterSingletonType<MockFingerprints>(uri, 0, 1, "Fingerprints", service_provider);
26+ qmlRegisterType<MockObserver>(uri, 0, 0, "Observer");
34}
27}
tests/mocks/Ubuntu/Fingerprints/plugin.h → tests/mocks/Biometryd/plugin.hrenamed+3−3
@@ -14,8 +14,8 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
15 */
16
16
17−#ifndef MOCK_FINGERPRINTS_PLUGIN_H
17+#ifndef MOCK_BIOMETRYD_PLUGIN_H
18−#define MOCK_FINGERPRINTS_PLUGIN_H
18+#define MOCK_BIOMETRYD_PLUGIN_H
19
19
20#include <QQmlExtensionPlugin>
20#include <QQmlExtensionPlugin>
21
21
@@ -28,4 +28,4 @@ public:
28 void registerTypes(const char *uri) override;
28 void registerTypes(const char *uri) override;
29};
29};
30
30
31−#endif // MOCK_FINGERPRINTS_PLUGIN_H
31+#endif // MOCK_BIOMETRYD_PLUGIN_H
tests/mocks/Biometryd/qmldirnew file+3
@@ -0,0 +1,3 @@
1+module Biometryd
2+plugin MockBiometryd
3+typeinfo Biometryd.qmltypes
tests/mocks/CMakeLists.txt+1
@@ -29,6 +29,7 @@ macro(add_unity8_mock PLUGIN VERSION PATH)
29endmacro()
29endmacro()
30
30
31add_subdirectory(AccountsService)
31add_subdirectory(AccountsService)
32+add_subdirectory(Biometryd)
32add_subdirectory(Cursor)
33add_subdirectory(Cursor)
33add_subdirectory(GSettings.1.0)
34add_subdirectory(GSettings.1.0)
34add_subdirectory(indicator-service)
35add_subdirectory(indicator-service)
tests/mocks/Ubuntu/CMakeLists.txt−1
@@ -1,6 +1,5 @@
1add_subdirectory(Connectivity)
1add_subdirectory(Connectivity)
2add_subdirectory(DownloadDaemonListener)
2add_subdirectory(DownloadDaemonListener)
3−add_subdirectory(Fingerprints)
4add_subdirectory(Payments)
3add_subdirectory(Payments)
5add_subdirectory(SystemImage)
4add_subdirectory(SystemImage)
6add_subdirectory(SystemSettings)
5add_subdirectory(SystemSettings)
tests/mocks/Ubuntu/Fingerprints/CMakeLists.txtdeleted−10
@@ -1,10 +0,0 @@
1−set(MOCK_FINGERPRINTS_SOURCES
2− plugin.cpp
3− MockFingerprints.cpp
4−)
5−
6−add_library(MockFingerprints MODULE ${MOCK_FINGERPRINTS_SOURCES})
7−
8−qt5_use_modules(MockFingerprints Qml Quick Core)
9−
10−add_unity8_mock(Ubuntu.Fingerprints 0.1 Ubuntu/Fingerprints TARGETS MockFingerprints)
tests/mocks/Ubuntu/Fingerprints/Fingerprints.qmltypesdeleted−39
@@ -1,39 +0,0 @@
1−import QtQuick.tooling 1.2
2−
3−// This file describes the plugin-supplied types contained in the library.
4−// It is used for QML tooling purposes only.
5−//
6−// This file was auto-generated by:
7−// 'qmlplugindump -notrelocatable Ubuntu.Fingerprints 0.1 tests/mocks'
8−
9−Module {
10− dependencies: []
11− Component {
12− name: "MockFingerprints"
13− prototype: "QObject"
14− exports: ["Ubuntu.Fingerprints/Fingerprints 0.1"]
15− isCreatable: false
16− isSingleton: true
17− exportMetaObjectRevisions: [0]
18− Enum {
19− name: "IdentificationError"
20− values: {
21− "None": 0,
22− "Error": 1
23− }
24− }
25− Signal {
26− name: "identificationCompleted"
27− Parameter { name: "uid"; type: "int" }
28− }
29− Signal {
30− name: "identificationFailed"
31− Parameter { type: "IdentificationError" }
32− }
33− Method {
34− name: "mockIdentification"
35− Parameter { name: "uid"; type: "int" }
36− Parameter { name: "error"; type: "IdentificationError" }
37− }
38− }
39−}
tests/mocks/Ubuntu/Fingerprints/qmldirdeleted−3
@@ -1,3 +0,0 @@
1−module Ubuntu.Fingerprints
2−plugin MockFingerprints
3−typeinfo Fingerprints.qmltypes
tests/qmltests/Greeter/tst_Greeter.qml+14−11
@@ -19,7 +19,6 @@ import QtTest 1.0
19import ".."
19import ".."
20import "../../../qml/Greeter"
20import "../../../qml/Greeter"
21import Ubuntu.Components 1.3
21import Ubuntu.Components 1.3
22−import Ubuntu.Fingerprints 0.1
23import AccountsService 0.1
22import AccountsService 0.1
24import GSettings 1.0
23import GSettings 1.0
25import IntegratedLightDM 0.1 as LightDM
24import IntegratedLightDM 0.1 as LightDM
@@ -562,42 +561,46 @@ Item {
562 }
561 }
563
562
564 function test_fingerprintSuccess() {
563 function test_fingerprintSuccess() {
564+ var biometryd = findInvisibleChild(greeter, "biometryd");
565 selectUser("has-password");
565 selectUser("has-password");
566− Fingerprints.mockIdentification(0, Fingerprints.None);
566+ biometryd.mockIdentification(0, "");
567 verify(greeter.forcedUnlock);
567 verify(greeter.forcedUnlock);
568 }
568 }
569
569
570 function test_fingerprintFailureMessage() {
570 function test_fingerprintFailureMessage() {
571+ var biometryd = findInvisibleChild(greeter, "biometryd");
571 selectUser("has-password");
572 selectUser("has-password");
572− Fingerprints.mockIdentification(0, Fingerprints.Error);
573+ biometryd.mockIdentification(0, "error");
573 compare(viewShowErrorMessageSpy.count, 1);
574 compare(viewShowErrorMessageSpy.count, 1);
574 compare(viewShowErrorMessageSpy.signalArguments[0][0], i18n.tr("Try again"));
575 compare(viewShowErrorMessageSpy.signalArguments[0][0], i18n.tr("Try again"));
575 }
576 }
576
577
577 function test_fingerprintTooManyFailures() {
578 function test_fingerprintTooManyFailures() {
579+ var biometryd = findInvisibleChild(greeter, "biometryd");
578 selectUser("has-password");
580 selectUser("has-password");
579− Fingerprints.mockIdentification(0, Fingerprints.Error);
581+ biometryd.mockIdentification(0, "error");
580− Fingerprints.mockIdentification(0, Fingerprints.Error);
582+ biometryd.mockIdentification(0, "error");
581 compare(viewTryToUnlockSpy.count, 0);
583 compare(viewTryToUnlockSpy.count, 0);
582
584
583− Fingerprints.mockIdentification(0, Fingerprints.Error);
585+ biometryd.mockIdentification(0, "error");
584 compare(viewTryToUnlockSpy.count, 1);
586 compare(viewTryToUnlockSpy.count, 1);
585
587
586 compare(viewShowErrorMessageSpy.count, 3);
588 compare(viewShowErrorMessageSpy.count, 3);
587 }
589 }
588
590
589 function test_fingerprintFailureCountReset() {
591 function test_fingerprintFailureCountReset() {
592+ var biometryd = findInvisibleChild(greeter, "biometryd");
590 selectUser("has-password");
593 selectUser("has-password");
591− Fingerprints.mockIdentification(0, Fingerprints.Error);
594+ biometryd.mockIdentification(0, "error");
592− Fingerprints.mockIdentification(0, Fingerprints.Error);
595+ biometryd.mockIdentification(0, "error");
593 compare(viewTryToUnlockSpy.count, 0);
596 compare(viewTryToUnlockSpy.count, 0);
594
597
595 greeter.forceShow();
598 greeter.forceShow();
596− Fingerprints.mockIdentification(0, Fingerprints.Error);
599+ biometryd.mockIdentification(0, "error");
597− Fingerprints.mockIdentification(0, Fingerprints.Error);
600+ biometryd.mockIdentification(0, "error");
598 compare(viewTryToUnlockSpy.count, 0);
601 compare(viewTryToUnlockSpy.count, 0);
599
602
600− Fingerprints.mockIdentification(0, Fingerprints.Error);
603+ biometryd.mockIdentification(0, "error");
601 compare(viewTryToUnlockSpy.count, 1);
604 compare(viewTryToUnlockSpy.count, 1);
602
605
603 compare(viewShowErrorMessageSpy.count, 5);
606 compare(viewShowErrorMessageSpy.count, 5);
tests/qmltests/tst_Shell.qml+8−3
@@ -21,7 +21,6 @@ import GSettings 1.0
21import IntegratedLightDM 0.1 as LightDM
21import IntegratedLightDM 0.1 as LightDM
22import Ubuntu.Components 1.3
22import Ubuntu.Components 1.3
23import Ubuntu.Components.ListItems 1.3 as ListItem
23import Ubuntu.Components.ListItems 1.3 as ListItem
24−import Ubuntu.Fingerprints 0.1
25import Ubuntu.Telephony 0.1 as Telephony
24import Ubuntu.Telephony 0.1 as Telephony
26import Unity.Application 0.1
25import Unity.Application 0.1
27import Unity.Connectivity 0.1
26import Unity.Connectivity 0.1
@@ -332,12 +331,18 @@ Rectangle {
332 Row {
331 Row {
333 Button {
332 Button {
334 text: "Success"
333 text: "Success"
334+ onClicked: {
335+ var biometryd = findInvisibleChild(shell, "biometryd");
335− onClicked: Fingerprints.mockIdentification(0, Fingerprints.None)
336+ biometryd.mockIdentification(0, "");
337+ }
336 }
338 }
337
339
338 Button {
340 Button {
339 text: "Failure"
341 text: "Failure"
342+ onClicked: {
343+ var biometryd = findInvisibleChild(shell, "biometryd");
340− onClicked: Fingerprints.mockIdentification(0, Fingerprints.Error)
344+ biometryd.mockIdentification(0, "error");
345+ }
341 }
346 }
342 }
347 }
343 }
348 }