| 1 |
#!/bin/sh |
| 2 |
# Copyright 2022 Simon McVittie |
| 3 |
# SPDX-License-Identifier: LGPL-2.1-or-later |
| 4 |
|
| 5 |
set -e |
| 6 |
exec 2>&1 |
| 7 |
set -u |
| 8 |
set -x |
| 9 |
|
| 10 |
cd "$AUTOPKGTEST_TMP" |
| 11 |
HOME="$(pwd)" |
| 12 |
export HOME |
| 13 |
export NO_AT_BRIDGE=1 |
| 14 |
|
| 15 |
if [ -n "${DEB_HOST_GNU_TYPE:-}" ]; then |
| 16 |
CROSS_COMPILE="$DEB_HOST_GNU_TYPE-" |
| 17 |
else |
| 18 |
CROSS_COMPILE= |
| 19 |
fi |
| 20 |
|
| 21 |
cat > test.cpp <<'EOF' |
| 22 |
#include <QApplication> |
| 23 |
#include <QPushButton> |
| 24 |
#include <QTimer> |
| 25 |
#include <libportal-qt5/portal-qt5.h> |
| 26 |
|
| 27 |
int main (int argc, char *argv[]) |
| 28 |
{ |
| 29 |
XdpParent *parent; |
| 30 |
QApplication app(argc, argv); |
| 31 |
QPushButton button("Hello, world!"); |
| 32 |
button.show(); |
| 33 |
parent = xdp_parent_new_qt(button.window()->windowHandle()); |
| 34 |
Q_ASSERT(parent); |
| 35 |
QTimer::singleShot(1000, &app, SLOT(quit())); |
| 36 |
return app.exec(); |
| 37 |
} |
| 38 |
EOF |
| 39 |
|
| 40 |
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=870383 |
| 41 |
CXXFLAGS=-fPIC |
| 42 |
# <gio/gdbusintrospection.h> includes a struct member named "signals" |
| 43 |
# which conflicts with Qt's use |
| 44 |
CXXFLAGS="$CXXFLAGS -DQT_NO_SIGNALS_SLOTS_KEYWORDS" |
| 45 |
# Deliberately word-splitting, that's how pkg-config works: |
| 46 |
# shellcheck disable=SC2046 |
| 47 |
"${CROSS_COMPILE}g++" $CXXFLAGS -o test test.cpp $("${CROSS_COMPILE}pkgconf" --cflags --libs libportal-qt5 Qt5Widgets) |
| 48 |
test -x ./test |
| 49 |
set -- ./test |
| 50 |
|
| 51 |
if [ -z "${TEST_INTERACTIVE-}" ]; then |
| 52 |
set -- xvfb-run -a dbus-run-session -- "$@" |
| 53 |
fi |
| 54 |
|
| 55 |
"$@" |