on xenial help sign in
* Add --lightdm= argument to ./run.sh that lets developers choose which lightdm backend to use
0573806Michael Terry
qml/Components/Lockscreen.qml+3−1
@@ -68,7 +68,9 @@ Showable {
68 }
68 }
69
69
70 function clear(showAnimation) {
70 function clear(showAnimation) {
71+ if (pinPadLoader.item) {
71− pinPadLoader.item.clear(showAnimation);
72+ pinPadLoader.item.clear(showAnimation);
73+ }
72 }
74 }
73
75
74 function showInfoPopup(title, text) {
76 function showInfoPopup(title, text) {
qml/Shell.qml+4−4
@@ -261,7 +261,7 @@ Item {
261 }
261 }
262
262
263 onPromptlessChanged: {
263 onPromptlessChanged: {
264− if (LightDM.Greeter.promptless) {
264+ if (LightDM.Greeter.promptless && LightDM.Greeter.authenticated) {
265 lockscreen.hide()
265 lockscreen.hide()
266 } else {
266 } else {
267 lockscreen.reset();
267 lockscreen.reset();
@@ -312,7 +312,7 @@ Item {
312
312
313 property bool fullyShown: showProgress === 1.0
313 property bool fullyShown: showProgress === 1.0
314 readonly property real showProgress: MathUtils.clamp((1 - x/width) + greeter.showProgress - 1, 0, 1)
314 readonly property real showProgress: MathUtils.clamp((1 - x/width) + greeter.showProgress - 1, 0, 1)
315− onShowProgressChanged: if (LightDM.Greeter.promptless && showProgress === 0) greeter.login()
315+ onShowProgressChanged: if (LightDM.Greeter.authenticated && showProgress === 0) greeter.login()
316
316
317 Greeter {
317 Greeter {
318 id: greeter
318 id: greeter
@@ -350,7 +350,7 @@ Item {
350 if (greeter.narrowMode) {
350 if (greeter.narrowMode) {
351 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
351 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
352 }
352 }
353− if (!LightDM.Greeter.promptless) {
353+ if (!LightDM.Greeter.authenticated) {
354 lockscreen.reset();
354 lockscreen.reset();
355 lockscreen.show();
355 lockscreen.show();
356 }
356 }
@@ -403,7 +403,7 @@ Item {
403 }
403 }
404
404
405 if (LightDM.Greeter.active) {
405 if (LightDM.Greeter.active) {
406− if (!LightDM.Greeter.promptless) {
406+ if (!LightDM.Greeter.authenticated) {
407 lockscreen.show()
407 lockscreen.show()
408 }
408 }
409 greeter.hide()
409 greeter.hide()
run.sh+19−18
@@ -18,6 +18,7 @@ usage() {
18 echo " -f, --fake Force use of fake Qml modules." >&2
18 echo " -f, --fake Force use of fake Qml modules." >&2
19 echo " -p, --pinlock Use a pin protected user." >&2
19 echo " -p, --pinlock Use a pin protected user." >&2
20 echo " -k, --keylock Use a passphrase protected user." >&2
20 echo " -k, --keylock Use a passphrase protected user." >&2
21+ echo " -l, --lightdm Use the specified lightdm mock." >&2
21 echo " -g, --gdb Run through gdb." >&2
22 echo " -g, --gdb Run through gdb." >&2
22 echo " -h, --help Show this help." >&2
23 echo " -h, --help Show this help." >&2
23 echo " -m, --nomousetouch Run without -mousetouch argument." >&2
24 echo " -m, --nomousetouch Run without -mousetouch argument." >&2
@@ -25,16 +26,20 @@ usage() {
25 exit 1
26 exit 1
26}
27}
27
28
28−ARGS=`getopt -n$0 -u -a --longoptions="fake,pinlock,keylock,gdb,help,nomousetouch" -o "fpkghm" -- "$@"`
29+ARGS=`getopt -n$0 -u -a --longoptions="fake,pinlock,keylock,gdb,help,lightdm:,nomousetouch" -o "fpkl:ghm" -- "$@"`
29[ $? -ne 0 ] && usage
30[ $? -ne 0 ] && usage
30eval set -- "$ARGS"
31eval set -- "$ARGS"
31
32
32while [ $# -gt 0 ]
33while [ $# -gt 0 ]
33do
34do
34 case "$1" in
35 case "$1" in
35− -f|--fake) FAKE=true; USE_MOCKS=true;;
36+ -f|--fake) USE_MOCKS=true;;
36− -p|--pinlock) PINLOCK=true; USE_MOCKS=true;;
37+ -p|--pinlock) USE_MOCKS=true; LIGHTDM_MOCK=single-pin;;
37− -k|--keylock) KEYLOCK=true; USE_MOCKS=true;;
38+ -k|--keylock) USE_MOCKS=true; LIGHTDM_MOCK=single-passphrase;;
39+ -l|--lightdm) LIGHTDM_MOCK=$2; shift;
40+ if [ -z "$LIGHTDM_MOCK" ]; then
41+ echo "Please specify an argument to --lightdm"
42+ fi;;
38 -g|--gdb) GDB=true;;
43 -g|--gdb) GDB=true;;
39 -h|--help) usage;;
44 -h|--help) usage;;
40 -m|--nomousetouch) MOUSE_TOUCH=false;;
45 -m|--nomousetouch) MOUSE_TOUCH=false;;
@@ -43,27 +48,23 @@ do
43 shift
48 shift
44done
49done
45
50
46−if $FAKE; then
51+if [ -z "$LIGHTDM_MOCK" ]; then
47− export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/builddir/tests/mocks/libusermetrics:$PWD/builddir/tests/mocks/LightDM/single
52+ LIGHTDM_MOCK=single
48fi
53fi
49
54
50−if $PINLOCK; then
55+# Even without USE_MOCKS set, we want to fake our lightdm backend, because it's
51− export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/builddir/tests/mocks/libusermetrics:$PWD/builddir/tests/mocks/LightDM/single-pin
56+# annoying to be prompted for your password when testing. To get the same
52−fi
57+# backend used in production, pass '--lightdm=demo'.
53−
54−if $KEYLOCK; then
55− export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/builddir/tests/mocks/libusermetrics:$PWD/builddir/tests/mocks/LightDM/single-passphrase
58+export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/builddir/tests/mocks/LightDM/$LIGHTDM_MOCK
56−fi
57
59
58if $USE_MOCKS; then
60if $USE_MOCKS; then
59 rm -f $PWD/builddir/nonmirplugins/LightDM # undo symlink (from below) for cleanliness
61 rm -f $PWD/builddir/nonmirplugins/LightDM # undo symlink (from below) for cleanliness
60 export QML2_IMPORT_PATH=$QML2_IMPORT_PATH:$PWD/builddir/tests/mocks:$PWD/builddir/plugins:$PWD/builddir/modules
62 export QML2_IMPORT_PATH=$QML2_IMPORT_PATH:$PWD/builddir/tests/mocks:$PWD/builddir/plugins:$PWD/builddir/modules
63+ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/builddir/tests/mocks/libusermetrics
61else
64else
62− # Still fake no-login user for convenience (it's annoying to be prompted for your password when testing)
63− # And in particular, just link our LightDM mock into the nonmirplugins folder. We don't want the rest of
65+ # Just link our LightDM mock into the nonmirplugins folder. We don't want
64− # our plugins to be used.
66+ # the rest of our plugins to be used.
65− ln -s $PWD/builddir/tests/mocks/LightDM $PWD/builddir/nonmirplugins/
67+ ln -sf $PWD/builddir/tests/mocks/LightDM $PWD/builddir/nonmirplugins/
66− export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/builddir/tests/mocks/LightDM/single
67fi
68fi
68
69
69QML_PHONE_SHELL_ARGS=""
70QML_PHONE_SHELL_ARGS=""
tests/mocks/LightDM/demo/CMakeLists.txt+13
@@ -9,6 +9,7 @@ set(LibLightDM_SOURCES
9 )
9 )
10
10
11add_library(MockLightDM-demo STATIC ${LibLightDM_SOURCES})
11add_library(MockLightDM-demo STATIC ${LibLightDM_SOURCES})
12+add_library(MockLightDM-demo-shared SHARED ${LibLightDM_SOURCES})
12
13
13include_directories(
14include_directories(
14 ${CMAKE_CURRENT_BINARY_DIR}
15 ${CMAKE_CURRENT_BINARY_DIR}
@@ -19,5 +20,17 @@ target_link_libraries(MockLightDM-demo
19 ${LIBUSERMETRICSOUTPUT_LDFLAGS}
20 ${LIBUSERMETRICSOUTPUT_LDFLAGS}
20 -lpam
21 -lpam
21)
22)
23+target_link_libraries(MockLightDM-demo-shared
24+ ${LIBUSERMETRICSOUTPUT_LDFLAGS}
25+ -lpam
26+)
22
27
23qt5_use_modules(MockLightDM-demo Concurrent Gui)
28qt5_use_modules(MockLightDM-demo Concurrent Gui)
29+qt5_use_modules(MockLightDM-demo-shared Concurrent Gui)
30+
31+set_target_properties(MockLightDM-demo-shared PROPERTIES
32+ OUTPUT_NAME lightdm-qt5-2)
33+
34+install(TARGETS MockLightDM-demo-shared
35+ DESTINATION ${SHELL_INSTALL_QML}/mocks/LightDM/demo
36+ )