Skip to content

Commit

Permalink
Add tests for Qt6 client library
Browse files Browse the repository at this point in the history
  • Loading branch information
Gliese852 committed Aug 6, 2024
1 parent 56c6ce3 commit 1073cc9
Show file tree
Hide file tree
Showing 36 changed files with 131 additions and 8 deletions.
37 changes: 37 additions & 0 deletions tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,42 @@ TESTS += \
test-power-qt5
endif

if COMPILE_LIBLIGHTDM_QT6
TESTS += \
test-autologin-timeout-qt6 \
test-autologin-guest-timeout-qt6 \
test-autologin-session-timeout-qt6 \
test-cancel-authentication-qt6 \
test-login-qt6 \
test-login-manual-qt6 \
test-login-manual-previous-session-qt6 \
test-login-no-password-qt6 \
test-login-long-username-qt6 \
test-login-long-password-qt6 \
test-login-two-factor-qt6 \
test-login-new-authtok-qt6 \
test-login-info-prompt-qt6 \
test-login-multi-info-prompt-qt6 \
test-login-previous-session-qt6 \
test-login-wrong-password-qt6 \
test-login-invalid-user-qt6 \
test-login-invalid-session-qt6 \
test-login-logout-qt6 \
test-login-pick-session-qt6 \
test-login-remember-session-qt6 \
test-login-manual-remember-session-qt6 \
test-login-guest-qt6 \
test-login-guest-pick-session-qt6 \
test-login-guest-disabled-qt6 \
test-login-guest-no-setup-script-qt6 \
test-login-guest-fail-setup-script-qt6 \
test-login-guest-logout-qt6 \
test-login-remote-session-qt6 \
test-sessions-qt6 \
test-users-qt6 \
test-power-qt6
endif

EXTRA_DIST = \
$(TESTS) \
data/remote-sessions/test-remote.desktop \
Expand All @@ -345,6 +381,7 @@ EXTRA_DIST = \
data/greeters/test-mir-greeter.desktop \
data/greeters/test-python-greeter.desktop \
data/greeters/test-qt5-greeter.desktop \
data/greeters/test-qt6-greeter.desktop \
data/greeters/test-wayland-greeter.desktop \
data/keys.conf \
data/sessions/alternative.desktop \
Expand Down
4 changes: 4 additions & 0 deletions tests/data/greeters/test-qt6-greeter.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[Desktop Entry]
Name=Test Qt6 Greeter
Comment=LightDM test Qt6 greeter
Exec=test-qt6-greeter
22 changes: 20 additions & 2 deletions tests/src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ if COMPILE_LIBLIGHTDM_QT5
noinst_PROGRAMS += test-qt5-greeter
endif

if COMPILE_LIBLIGHTDM_QT6
noinst_PROGRAMS += test-qt6-greeter
endif

dbus_env_CFLAGS = \
$(WARN_CFLAGS) \
$(GLIB_CFLAGS) \
Expand Down Expand Up @@ -139,23 +143,32 @@ test_script_hook_LDADD = \

test-qt5-greeter_moc5.cpp: test-qt-greeter.h
$(am__v_MOC5_$(V)) $(MOC5) $< -o $@
test-qt6-greeter_moc6.cpp: test-qt-greeter.h
$(MOC6) $< -o $@
common_qt_sources = test-qt-greeter.cpp test-qt-greeter.h status.c status.h
test_qt5_greeter_SOURCES = $(common_qt_sources)
test_qt6_greeter_SOURCES = $(common_qt_sources)
nodist_test_qt5_greeter_SOURCES = test-qt5-greeter_moc5.cpp
nodist_test_qt6_greeter_SOURCES = test-qt6-greeter_moc6.cpp
common_qt_cflags = \
$(WARN_CXXFLAGS) \
$(GLIB_CFLAGS) \
$(GIO_UNIX_CFLAGS) \
$(XCB_CFLAGS)
test_qt5_greeter_CFLAGS = $(common_qt_cflags)
test_qt6_greeter_CFLAGS = $(common_qt_cflags)
common_qt_cxxflags = \
-fPIC \
-DQT_DISABLE_DEPRECATED_BEFORE="QT_VERSION_CHECK(4, 0, 0)" \
-I$(top_srcdir)/liblightdm-qt \
$(GLIB_CFLAGS)
test_qt5_greeter_CXXFLAGS = \
$(common_qt_cxxflags) \
-DQT_DISABLE_DEPRECATED_BEFORE="QT_VERSION_CHECK(4, 0, 0)" \
$(LIBLIGHTDM_QT5_CFLAGS)
test_qt6_greeter_CXXFLAGS = \
$(common_qt_cxxflags) \
-DQT_DISABLE_DEPRECATED_BEFORE="QT_VERSION_CHECK(5, 0, 0)" \
$(LIBLIGHTDM_QT6_CFLAGS)
common_qt_ldadd = \
-L$(top_builddir)/liblightdm-gobject \
-llightdm-gobject-1 \
Expand All @@ -167,6 +180,10 @@ test_qt5_greeter_LDADD = \
$(common_qt_ldadd) \
-llightdm-qt5-3 \
$(LIBLIGHTDM_QT5_LIBS)
test_qt6_greeter_LDADD = \
$(common_qt_ldadd) \
-llightdm-qt6-3 \
$(LIBLIGHTDM_QT6_LIBS)

test_session_SOURCES = test-session.c status.c status.h
test_session_CFLAGS = \
Expand Down Expand Up @@ -212,7 +229,8 @@ vnc_client_LDADD = \
$(GIO_UNIX_LIBS)

CLEANFILES = \
test-qt5-greeter_moc5.cpp
test-qt5-greeter_moc5.cpp \
test-qt6-greeter_moc6.cpp

# Support pretty printing MOC
AM_V_MOC5 = $(am__v_MOC5_$(V))
Expand Down
12 changes: 6 additions & 6 deletions tests/src/test-qt-greeter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,20 @@ TestGreeter::TestGreeter ()

void TestGreeter::showMessage (QString text, QLightDM::Greeter::MessageType type)
{
status_notify ("%s SHOW-MESSAGE TEXT=\"%s\"", greeter_id, text.toAscii ().constData ());
status_notify ("%s SHOW-MESSAGE TEXT=\"%s\"", greeter_id, text.toLatin1 ().constData ());
}

void TestGreeter::showPrompt (QString text, QLightDM::Greeter::PromptType type)
{
status_notify ("%s SHOW-PROMPT TEXT=\"%s\"", greeter_id, text.toAscii ().constData ());
status_notify ("%s SHOW-PROMPT TEXT=\"%s\"", greeter_id, text.toLatin1 ().constData ());
}

void TestGreeter::authenticationComplete ()
{
if (authenticationUser () != "")
status_notify ("%s AUTHENTICATION-COMPLETE USERNAME=%s AUTHENTICATED=%s",
greeter_id,
authenticationUser ().toAscii ().constData (), isAuthenticated () ? "TRUE" : "FALSE");
authenticationUser ().toLatin1 ().constData (), isAuthenticated () ? "TRUE" : "FALSE");
else
status_notify ("%s AUTHENTICATION-COMPLETE AUTHENTICATED=%s", greeter_id, isAuthenticated () ? "TRUE" : "FALSE");
}
Expand All @@ -59,7 +59,7 @@ void TestGreeter::autologinTimerExpired ()
void TestGreeter::printHints ()
{
if (selectUserHint() != "")
status_notify ("%s SELECT-USER-HINT USERNAME=%s", greeter_id, greeter->selectUserHint ().toAscii ().constData ());
status_notify ("%s SELECT-USER-HINT USERNAME=%s", greeter_id, greeter->selectUserHint ().toLatin1 ().constData ());
if (selectGuestHint())
status_notify ("%s SELECT-GUEST-HINT", greeter_id);
if (lockHint())
Expand All @@ -73,11 +73,11 @@ void TestGreeter::printHints ()
if (!showRemoteLoginHint ())
status_notify ("%s SHOW-REMOTE-LOGIN-HINT=FALSE", greeter_id);
if (autologinUserHint () != "")
status_notify ("%s AUTOLOGIN-USER-HINT=%s", greeter_id, autologinUserHint ().toAscii ().constData ());
status_notify ("%s AUTOLOGIN-USER-HINT=%s", greeter_id, autologinUserHint ().toLatin1 ().constData ());
if (autologinGuestHint ())
status_notify ("%s AUTOLOGIN-GUEST-HINT", greeter_id);
if (autologinSessionHint () != "")
status_notify ("%s AUTOLOGIN-SESSION-HINT=%s", greeter_id, autologinSessionHint ().toAscii ().constData ());
status_notify ("%s AUTOLOGIN-SESSION-HINT=%s", greeter_id, autologinSessionHint ().toLatin1 ().constData ());
if (autologinTimeoutHint () != 0)
status_notify ("%s AUTOLOGIN-TIMEOUT-HINT=%d", greeter_id, autologinTimeoutHint ());
}
Expand Down
2 changes: 2 additions & 0 deletions tests/test-autologin-guest-timeout-qt6
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
./src/dbus-env ./src/test-runner autologin-guest-timeout test-qt6-greeter
2 changes: 2 additions & 0 deletions tests/test-autologin-session-timeout-qt6
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
./src/dbus-env ./src/test-runner autologin-session-timeout test-qt6-greeter
2 changes: 2 additions & 0 deletions tests/test-autologin-timeout-qt6
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
./src/dbus-env ./src/test-runner autologin-timeout test-qt6-greeter
2 changes: 2 additions & 0 deletions tests/test-cancel-authentication-qt6
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
./src/dbus-env ./src/test-runner cancel-authentication test-qt6-greeter
2 changes: 2 additions & 0 deletions tests/test-login-guest-disabled-qt6
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
./src/dbus-env ./src/test-runner login-guest-disabled test-qt6-greeter
2 changes: 2 additions & 0 deletions tests/test-login-guest-fail-setup-script-qt6
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
./src/dbus-env ./src/test-runner login-guest-fail-setup-script test-qt6-greeter
2 changes: 2 additions & 0 deletions tests/test-login-guest-logout-qt6
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
./src/dbus-env ./src/test-runner login-guest-logout test-qt6-greeter
2 changes: 2 additions & 0 deletions tests/test-login-guest-no-setup-script-qt6
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
./src/dbus-env ./src/test-runner login-guest-no-setup-script test-qt6-greeter
2 changes: 2 additions & 0 deletions tests/test-login-guest-pick-session-qt6
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
./src/dbus-env ./src/test-runner login-guest-pick-session test-qt6-greeter
2 changes: 2 additions & 0 deletions tests/test-login-guest-qt6
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
./src/dbus-env ./src/test-runner login-guest test-qt6-greeter
2 changes: 2 additions & 0 deletions tests/test-login-info-prompt-qt6
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
./src/dbus-env ./src/test-runner login-info-prompt test-qt6-greeter
2 changes: 2 additions & 0 deletions tests/test-login-invalid-session-qt6
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
./src/dbus-env ./src/test-runner login-invalid-session test-qt6-greeter
2 changes: 2 additions & 0 deletions tests/test-login-invalid-user-qt6
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
./src/dbus-env ./src/test-runner login-invalid-user test-qt6-greeter
2 changes: 2 additions & 0 deletions tests/test-login-logout-qt6
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
./src/dbus-env ./src/test-runner login-logout test-qt6-greeter
2 changes: 2 additions & 0 deletions tests/test-login-long-password-qt6
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
./src/dbus-env ./src/test-runner login-long-password test-qt6-greeter
2 changes: 2 additions & 0 deletions tests/test-login-long-username-qt6
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
./src/dbus-env ./src/test-runner login-long-username test-qt6-greeter
2 changes: 2 additions & 0 deletions tests/test-login-manual-previous-session-qt6
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
./src/dbus-env ./src/test-runner login-manual-previous-session test-qt6-greeter
2 changes: 2 additions & 0 deletions tests/test-login-manual-qt6
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
./src/dbus-env ./src/test-runner login-manual test-qt6-greeter
2 changes: 2 additions & 0 deletions tests/test-login-manual-remember-session-qt6
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
./src/dbus-env ./src/test-runner login-manual-remember-session test-qt6-greeter
2 changes: 2 additions & 0 deletions tests/test-login-multi-info-prompt-qt6
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
./src/dbus-env ./src/test-runner login-multi-info-prompt test-qt6-greeter
2 changes: 2 additions & 0 deletions tests/test-login-new-authtok-qt6
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
./src/dbus-env ./src/test-runner login-new-authtok test-qt6-greeter
2 changes: 2 additions & 0 deletions tests/test-login-no-password-qt6
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
./src/dbus-env ./src/test-runner login-no-password test-qt6-greeter
2 changes: 2 additions & 0 deletions tests/test-login-pick-session-qt6
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
./src/dbus-env ./src/test-runner login-pick-session test-qt6-greeter
2 changes: 2 additions & 0 deletions tests/test-login-previous-session-qt6
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
./src/dbus-env ./src/test-runner login-previous-session test-qt6-greeter
2 changes: 2 additions & 0 deletions tests/test-login-qt6
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
./src/dbus-env ./src/test-runner login test-qt6-greeter
2 changes: 2 additions & 0 deletions tests/test-login-remember-session-qt6
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
./src/dbus-env ./src/test-runner login-remember-session test-qt6-greeter
2 changes: 2 additions & 0 deletions tests/test-login-remote-session-qt6
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
./src/dbus-env ./src/test-runner login-remote-session test-qt6-greeter
2 changes: 2 additions & 0 deletions tests/test-login-two-factor-qt6
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
./src/dbus-env ./src/test-runner login-two-factor test-qt6-greeter
2 changes: 2 additions & 0 deletions tests/test-login-wrong-password-qt6
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
./src/dbus-env ./src/test-runner login-wrong-password test-qt6-greeter
2 changes: 2 additions & 0 deletions tests/test-power-qt6
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
./src/dbus-env ./src/test-runner power test-qt6-greeter
2 changes: 2 additions & 0 deletions tests/test-sessions-qt6
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
./src/dbus-env ./src/test-runner sessions test-qt6-greeter
2 changes: 2 additions & 0 deletions tests/test-users-qt6
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
./src/dbus-env ./src/test-runner users test-qt6-greeter

0 comments on commit 1073cc9

Please sign in to comment.