tests: replace gtk-embedder.py with a gtk3 app
All linux CI machines have gtk3 installed. And Python GTK things are too complicate to setup. Pick-to: 6.4 6.3 6.2 5.15 Change-Id: I3c0d967f61aebea508784df79569b9d0064f66e2 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
8e9fdfec0a
commit
aef55501bc
@ -61,8 +61,9 @@ add_subdirectory(windowflags)
|
|||||||
add_subdirectory(windowgeometry)
|
add_subdirectory(windowgeometry)
|
||||||
add_subdirectory(windowmodality)
|
add_subdirectory(windowmodality)
|
||||||
add_subdirectory(widgetgrab)
|
add_subdirectory(widgetgrab)
|
||||||
add_subdirectory(xembed-raster)
|
if(QT_FEATURE_xcb)
|
||||||
add_subdirectory(xembed-widgets)
|
add_subdirectory(xembed)
|
||||||
|
endif()
|
||||||
add_subdirectory(shortcuts)
|
add_subdirectory(shortcuts)
|
||||||
add_subdirectory(dialogs)
|
add_subdirectory(dialogs)
|
||||||
add_subdirectory(windowtransparency)
|
add_subdirectory(windowtransparency)
|
||||||
|
@ -47,8 +47,6 @@ windowflags \
|
|||||||
windowgeometry \
|
windowgeometry \
|
||||||
windowmodality \
|
windowmodality \
|
||||||
widgetgrab \
|
widgetgrab \
|
||||||
xembed-raster \
|
|
||||||
xembed-widgets \
|
|
||||||
shortcuts \
|
shortcuts \
|
||||||
dialogs \
|
dialogs \
|
||||||
windowtransparency \
|
windowtransparency \
|
||||||
@ -66,3 +64,5 @@ qtConfig(opengl) {
|
|||||||
win32: SUBDIRS -= network_remote_stresstest network_stresstest
|
win32: SUBDIRS -= network_remote_stresstest network_stresstest
|
||||||
|
|
||||||
qtConfig(vulkan): SUBDIRS += qvulkaninstance
|
qtConfig(vulkan): SUBDIRS += qvulkaninstance
|
||||||
|
|
||||||
|
qtConfig(xcb): SUBDIRS += xembed
|
||||||
|
@ -1,36 +0,0 @@
|
|||||||
#!/usr/bin/python
|
|
||||||
# Copyright (C) 2013 Canonical Ltd.
|
|
||||||
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
||||||
|
|
||||||
from gi.repository import Gtk
|
|
||||||
from subprocess import Popen
|
|
||||||
|
|
||||||
window = Gtk.Window()
|
|
||||||
|
|
||||||
box = Gtk.VBox(False, 0)
|
|
||||||
window.add(box)
|
|
||||||
|
|
||||||
child = None
|
|
||||||
def on_button_clicked(button, socket):
|
|
||||||
global child
|
|
||||||
child = Popen(['./rasterwindow', str(socket.get_id())])
|
|
||||||
|
|
||||||
button = Gtk.Button("Press me to embed a Qt client")
|
|
||||||
box.pack_start(button, False, False, 0)
|
|
||||||
|
|
||||||
socket = Gtk.Socket()
|
|
||||||
socket.set_size_request(200, 200)
|
|
||||||
box.add(socket)
|
|
||||||
|
|
||||||
button.connect("clicked", on_button_clicked, socket)
|
|
||||||
window.connect("destroy", Gtk.main_quit)
|
|
||||||
|
|
||||||
def plugged_event(widget):
|
|
||||||
print("A window was embedded!")
|
|
||||||
|
|
||||||
socket.connect("plug-added", plugged_event)
|
|
||||||
|
|
||||||
window.show_all()
|
|
||||||
Gtk.main()
|
|
||||||
if child:
|
|
||||||
child.terminate()
|
|
@ -1,39 +0,0 @@
|
|||||||
#!/usr/bin/python
|
|
||||||
# Copyright (C) 2013 Canonical Ltd.
|
|
||||||
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
||||||
|
|
||||||
from gi.repository import Gtk
|
|
||||||
from subprocess import Popen
|
|
||||||
|
|
||||||
window = Gtk.Window()
|
|
||||||
|
|
||||||
box = Gtk.VBox(False, 0)
|
|
||||||
window.add(box)
|
|
||||||
|
|
||||||
child = None
|
|
||||||
def on_button_clicked(button, socket):
|
|
||||||
global child
|
|
||||||
child = Popen(['./lineedits', str(socket.get_id())])
|
|
||||||
|
|
||||||
button = Gtk.Button("Press me to embed a Qt client")
|
|
||||||
box.pack_start(button, False, False, 0)
|
|
||||||
|
|
||||||
entry = Gtk.Entry()
|
|
||||||
box.pack_start(entry, False, False, 0)
|
|
||||||
|
|
||||||
socket = Gtk.Socket()
|
|
||||||
socket.set_size_request(200, 200)
|
|
||||||
box.add(socket)
|
|
||||||
|
|
||||||
button.connect("clicked", on_button_clicked, socket)
|
|
||||||
window.connect("destroy", Gtk.main_quit)
|
|
||||||
|
|
||||||
def plugged_event(widget):
|
|
||||||
print("A window was embedded!")
|
|
||||||
|
|
||||||
socket.connect("plug-added", plugged_event)
|
|
||||||
|
|
||||||
window.show_all()
|
|
||||||
Gtk.main()
|
|
||||||
if child:
|
|
||||||
child.terminate()
|
|
7
tests/manual/xembed/CMakeLists.txt
Normal file
7
tests/manual/xembed/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# Generated from xembed.pro.
|
||||||
|
|
||||||
|
if(QT_FEATURE_gtk3)
|
||||||
|
add_subdirectory(gtk-container)
|
||||||
|
endif()
|
||||||
|
add_subdirectory(qt-client-raster)
|
||||||
|
add_subdirectory(qt-client-widget)
|
27
tests/manual/xembed/gtk-container/CMakeLists.txt
Normal file
27
tests/manual/xembed/gtk-container/CMakeLists.txt
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# Generated from gtk-container.pro.
|
||||||
|
|
||||||
|
qt_find_package(GTK3) # special case
|
||||||
|
qt_find_package(X11) # special case
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
## gtk-container Binary:
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
qt_internal_add_manual_test(gtk-container
|
||||||
|
GUI
|
||||||
|
SOURCES
|
||||||
|
gtk-container.cpp
|
||||||
|
DEFINES
|
||||||
|
GDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_6
|
||||||
|
LIBRARIES # special case
|
||||||
|
PkgConfig::GTK3
|
||||||
|
Qt::Core
|
||||||
|
Qt::CorePrivate
|
||||||
|
Qt::Gui
|
||||||
|
Qt::GuiPrivate
|
||||||
|
X11::X11 # special case
|
||||||
|
)
|
||||||
|
|
||||||
|
#### Keys ignored in scope 1:.:.:qt-client-widget.pro:<TRUE>:
|
||||||
|
# TEMPLATE = "app"
|
||||||
|
|
43
tests/manual/xembed/gtk-container/gtk-container.cpp
Normal file
43
tests/manual/xembed/gtk-container/gtk-container.cpp
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
// Copyright (C) 2022 The Qt Company Ltd.
|
||||||
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||||
|
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
#include <gtk/gtkx.h>
|
||||||
|
|
||||||
|
gchar *cmd;
|
||||||
|
|
||||||
|
void launch_app(GtkButton */* btn */, guint32 *id)
|
||||||
|
{
|
||||||
|
gchar *command = g_strdup_printf("%s %u", cmd, *id);
|
||||||
|
g_spawn_command_line_async(command, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
gint main(gint argc, gchar **argv)
|
||||||
|
{
|
||||||
|
if (argc <=1 || argc > 2) {
|
||||||
|
g_print("No client application defined.\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd = g_strdup_printf("%s", argv[1]);
|
||||||
|
|
||||||
|
gtk_init(&argc, &argv);
|
||||||
|
|
||||||
|
GtkWidget *win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||||
|
GtkWidget *vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
|
||||||
|
GtkWidget *sock = gtk_socket_new();
|
||||||
|
GtkWidget *btn = gtk_button_new_with_label("Hello, World!");
|
||||||
|
g_signal_connect(sock, "plug-removed", gtk_main_quit, NULL);
|
||||||
|
g_signal_connect(win, "delete-event", gtk_main_quit, NULL);
|
||||||
|
gtk_widget_set_size_request(sock, 200, 200);
|
||||||
|
gtk_box_pack_start(GTK_BOX(vbox), btn, FALSE, FALSE, 0);
|
||||||
|
gtk_box_pack_start(GTK_BOX(vbox), sock, TRUE, TRUE, 0);
|
||||||
|
gtk_container_add(GTK_CONTAINER(win), vbox);
|
||||||
|
gtk_widget_show_all(win);
|
||||||
|
|
||||||
|
guint32 id = gtk_socket_get_id(GTK_SOCKET(sock));
|
||||||
|
g_signal_connect(btn, "clicked", G_CALLBACK(launch_app), &id);
|
||||||
|
|
||||||
|
gtk_main();
|
||||||
|
return 0;
|
||||||
|
}
|
16
tests/manual/xembed/gtk-container/gtk-container.pro
Normal file
16
tests/manual/xembed/gtk-container/gtk-container.pro
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
TEMPLATE = app
|
||||||
|
TARGET = gtk-container
|
||||||
|
QT_FOR_CONFIG += widgets-private
|
||||||
|
INCLUDEPATH += .
|
||||||
|
CONFIG += X11
|
||||||
|
QMAKE_USE += gtk3
|
||||||
|
|
||||||
|
# You can make your code fail to compile if you use deprecated APIs.
|
||||||
|
# In order to do so, uncomment the following line.
|
||||||
|
# Please consult the documentation of the deprecated API in order to know
|
||||||
|
# how to port your code away from it.
|
||||||
|
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||||
|
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||||
|
|
||||||
|
# Input
|
||||||
|
SOURCES += gtk-container.cpp
|
@ -1,13 +1,13 @@
|
|||||||
# Copyright (C) 2022 The Qt Company Ltd.
|
# Copyright (C) 2022 The Qt Company Ltd.
|
||||||
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||||
|
|
||||||
# Generated from xembed-raster.pro.
|
# Generated from qt-client-raster.pro.
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
## tst_manual_rasterwindow Binary:
|
## qt-client-raster Binary:
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
qt_internal_add_manual_test(tst_manual_rasterwindow
|
qt_internal_add_manual_test(qt-client-raster
|
||||||
GUI
|
GUI
|
||||||
SOURCES
|
SOURCES
|
||||||
main.cpp
|
main.cpp
|
||||||
@ -16,5 +16,5 @@ qt_internal_add_manual_test(tst_manual_rasterwindow
|
|||||||
Qt::Gui
|
Qt::Gui
|
||||||
)
|
)
|
||||||
|
|
||||||
#### Keys ignored in scope 1:.:.:xembed-raster.pro:<TRUE>:
|
#### Keys ignored in scope 1:.:.:qt-client-raster.pro:<TRUE>:
|
||||||
# TEMPLATE = "app"
|
# TEMPLATE = "app"
|
@ -1,5 +1,5 @@
|
|||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
TARGET= tst_manual_rasterwindow
|
TARGET= qt-client-raster
|
||||||
QT += gui
|
QT += gui
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
@ -19,10 +19,10 @@ public slots:
|
|||||||
void renderNow();
|
void renderNow();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool event(QEvent *event);
|
bool event(QEvent *event) override;
|
||||||
|
|
||||||
void resizeEvent(QResizeEvent *event);
|
void resizeEvent(QResizeEvent *event) override;
|
||||||
void exposeEvent(QExposeEvent *event);
|
void exposeEvent(QExposeEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QBackingStore *m_backingStore;
|
QBackingStore *m_backingStore;
|
@ -1,13 +1,13 @@
|
|||||||
# Copyright (C) 2022 The Qt Company Ltd.
|
# Copyright (C) 2022 The Qt Company Ltd.
|
||||||
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||||
|
|
||||||
# Generated from xembed-widgets.pro.
|
# Generated from qt-client-widget.pro.
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
## tst_manual_lineedits Binary:
|
## qt-client-widget Binary:
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
qt_internal_add_manual_test(tst_manual_lineedits
|
qt_internal_add_manual_test(qt-client-widget
|
||||||
GUI
|
GUI
|
||||||
SOURCES
|
SOURCES
|
||||||
main.cpp
|
main.cpp
|
||||||
@ -17,5 +17,5 @@ qt_internal_add_manual_test(tst_manual_lineedits
|
|||||||
Qt::Widgets
|
Qt::Widgets
|
||||||
)
|
)
|
||||||
|
|
||||||
#### Keys ignored in scope 1:.:.:xembed-widgets.pro:<TRUE>:
|
#### Keys ignored in scope 1:.:.:qt-client-widget.pro:<TRUE>:
|
||||||
# TEMPLATE = "app"
|
# TEMPLATE = "app"
|
@ -1,5 +1,5 @@
|
|||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
TARGET= tst_manual_lineedits
|
TARGET= qt-client-widget
|
||||||
QT += widgets
|
QT += widgets
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
11
tests/manual/xembed/xembed.pro
Normal file
11
tests/manual/xembed/xembed.pro
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
TEMPLATE=subdirs
|
||||||
|
QT_FOR_CONFIG += network-private gui-private
|
||||||
|
|
||||||
|
TEMPLATE = subdirs
|
||||||
|
QT_FOR_CONFIG += widgets-private
|
||||||
|
|
||||||
|
SUBDIRS = \
|
||||||
|
qt-client-raster \
|
||||||
|
qt-client-widget
|
||||||
|
|
||||||
|
qtHaveModule(widgets):qtConfig(gtk3): SUBDIRS += gtk-container
|
Loading…
x
Reference in New Issue
Block a user