Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GTK4 and QT6 to toolkit testsuite
- Loading branch information
Showing
25 changed files
with
335 additions
and
13 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
.PHONY: clean | ||
|
||
objects = fltk gtk2 gtk3 gtk4 motif qt4 qt5 qt6 swing.class | ||
|
||
all: $(objects) | ||
|
||
fltk: fltk.cc | ||
g++ -o $@ $< -lfltk | ||
|
||
gtk2: gtk2.c | ||
gcc -o $@ $< `pkg-config --cflags --libs gtk+-2.0` | ||
|
||
gtk3: gtk3.c | ||
gcc -o $@ $< `pkg-config --cflags --libs gtk+-3.0` | ||
|
||
gtk4: gtk4.c | ||
gcc -o $@ $< `pkg-config --cflags --libs gtk4` | ||
|
||
motif: motif.c | ||
gcc -o $@ $< -lXm -lXt | ||
|
||
qt4: qt4.cc | ||
g++ -o $@ $< `pkg-config --cflags --libs QtCore QtGui` | ||
|
||
qt5: qt5.cc | ||
g++ -o $@ $< `pkg-config --cflags --libs Qt5Core Qt5Gui Qt5Widgets` -fPIC | ||
|
||
qt6: qt6.cc | ||
g++ -o $@ $< `pkg-config --cflags --libs Qt6Core Qt6Gui Qt6Widgets` -fPIC | ||
|
||
swing.class: swing.java | ||
javac $< | ||
|
||
clean: | ||
rm -f $(objects) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright SUSE LLC | ||
// SPDX-License-Identifier: FSFAP | ||
|
||
#include <FL/Fl.H> | ||
#include <FL/Fl_Window.H> | ||
#include <FL/Fl_Box.H> | ||
|
||
int main(int argc, char **argv) { | ||
Fl_Window *window = new Fl_Window(340,180); | ||
Fl_Box *box = new Fl_Box(20,40,300,100, "Hello World: FLTK"); | ||
box->box(FL_UP_BOX); | ||
box->labelsize(36); | ||
box->labelfont(FL_BOLD+FL_ITALIC); | ||
box->labeltype(FL_SHADOW_LABEL); | ||
window->end(); | ||
window->show(argc, argv); | ||
return Fl::run(); | ||
} | ||
|
||
// g++ fltk.cc -lfltk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright SUSE LLC | ||
// SPDX-License-Identifier: FSFAP | ||
|
||
#include <gtk/gtk.h> | ||
|
||
static void destroy(GtkWidget *widget, gpointer data) | ||
{ | ||
gtk_main_quit(); | ||
} | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
GtkWidget *window, *label; | ||
|
||
gtk_init(&argc, &argv); | ||
|
||
window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | ||
|
||
/* Here we connect the "destroy" event to a signal handler. | ||
* This event occurs when we call gtk_widget_destroy() on the window */ | ||
g_signal_connect(window, "destroy", G_CALLBACK(destroy), NULL); | ||
|
||
gtk_container_set_border_width(GTK_CONTAINER(window), 10); | ||
|
||
label = gtk_label_new("Hello World: GTK2"); | ||
|
||
gtk_container_add(GTK_CONTAINER(window), label); | ||
|
||
gtk_widget_show(label); | ||
gtk_widget_show(window); | ||
|
||
gtk_main(); | ||
|
||
return 0; | ||
} | ||
|
||
|
||
// gcc gtk2.c $(pkg-config --cflags --libs gtk+-2.0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright SUSE LLC | ||
// SPDX-License-Identifier: FSFAP | ||
|
||
#include <gtk/gtk.h> | ||
|
||
static void activate(GtkApplication *app, gpointer user_data) | ||
{ | ||
GtkWidget *window, *label , *button_box; | ||
|
||
window = gtk_application_window_new(app); | ||
gtk_window_set_title(GTK_WINDOW(window), "Window"); | ||
gtk_window_set_default_size(GTK_WINDOW(window), 200, 200); | ||
|
||
button_box = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL); | ||
gtk_container_add(GTK_CONTAINER(window), button_box); | ||
|
||
label = gtk_label_new("Hello World: GTK3"); | ||
gtk_container_add(GTK_CONTAINER(button_box), label); | ||
|
||
gtk_widget_show_all(window); | ||
} | ||
|
||
int main(int argc, char **argv) | ||
{ | ||
GtkApplication *app; | ||
int status; | ||
|
||
app = gtk_application_new("org.gtk.example", G_APPLICATION_FLAGS_NONE); | ||
g_signal_connect(app, "activate", G_CALLBACK(activate), NULL); | ||
status = g_application_run(G_APPLICATION(app), argc, argv); | ||
g_object_unref(app); | ||
|
||
return status; | ||
} | ||
|
||
|
||
// gcc gtk3.c $(pkg-config --cflags --libs gtk+-3.0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright SUSE LLC | ||
// SPDX-License-Identifier: FSFAP | ||
|
||
#include <gtk/gtk.h> | ||
|
||
static void activate(GtkApplication *app, gpointer user_data) { | ||
GtkWidget *window; | ||
GtkWidget *label; | ||
|
||
// Create a new window | ||
window = gtk_application_window_new(app); | ||
gtk_window_set_title(GTK_WINDOW(window), "Hello, World!"); | ||
|
||
// Create a label | ||
label = gtk_label_new("Hello, World!"); | ||
|
||
// Add the label to the window | ||
gtk_window_set_child(GTK_WINDOW(window), label); | ||
|
||
// Show the window | ||
gtk_widget_set_visible(GTK_WIDGET(window), TRUE); | ||
} | ||
|
||
int main(int argc, char *argv[]) { | ||
GtkApplication *app; | ||
int status; | ||
|
||
// Create a new application | ||
app = gtk_application_new("org.example.hello", G_APPLICATION_DEFAULT_FLAGS); | ||
|
||
// Connect the "activate" signal to the callback function | ||
g_signal_connect(app, "activate", G_CALLBACK(activate), NULL); | ||
|
||
// Run the application | ||
status = g_application_run(G_APPLICATION(app), argc, argv); | ||
|
||
// Clean up resources | ||
g_object_unref(app); | ||
|
||
return status; | ||
} | ||
|
||
// gcc gtk4.c $(pkg-config --cflags --libs gtk4) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright SUSE LLC | ||
// SPDX-License-Identifier: FSFAP | ||
|
||
#include <Xm/XmAll.h> | ||
|
||
void main(int argc, char *argv[]) | ||
{ | ||
Widget toplevel, main_w, button; | ||
XtAppContext app; | ||
|
||
XtSetLanguageProc(NULL, NULL, NULL); | ||
|
||
toplevel = XtVaAppInitialize(&app, "main", NULL, 0, &argc, argv, NULL, NULL); | ||
main_w = XtVaCreateManagedWidget("main_w", xmMainWindowWidgetClass, toplevel, XmNscrollingPolicy, XmAUTOMATIC, NULL); | ||
button = XtVaCreateWidget("Hello World: motif", xmLabelWidgetClass, main_w, NULL); | ||
|
||
XtManageChild(button); | ||
XtRealizeWidget(toplevel); | ||
XtAppMainLoop(app); | ||
} | ||
|
||
// gcc -lXm -lXt | ||
// source http://www2.latech.edu/~acm/helloworld/motif.html jlk@engr.latech.edu (Josh Kleinpeter) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright SUSE LLC | ||
// SPDX-License-Identifier: FSFAP | ||
|
||
#include <QtGui> | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
QApplication app(argc, argv); | ||
QLabel *label = new QLabel("Hello World: Qt4"); | ||
label->show(); | ||
return app.exec(); | ||
} | ||
|
||
// g++ qt4.cc $(pkg-config --cflags --libs QtGui) $(pkg-config --cflags --libs QtCore) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright SUSE LLC | ||
// SPDX-License-Identifier: FSFAP | ||
|
||
#include <QApplication> | ||
#include <QPushButton> | ||
|
||
int main(int argc, char **argv) | ||
{ | ||
QApplication app (argc, argv); | ||
|
||
QPushButton button ("Hello World: Qt5"); | ||
button.show(); | ||
|
||
return app.exec(); | ||
} | ||
|
||
// g++ qt5.cc $(pkg-config --cflags --libs Qt5Gui Qt5Core Qt5Widgets) -fPIC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright SUSE LLC | ||
// SPDX-License-Identifier: FSFAP | ||
|
||
#include <QApplication> | ||
#include <QPushButton> | ||
|
||
int main(int argc, char **argv) | ||
{ | ||
QApplication app(argc, argv); | ||
|
||
QPushButton button("Hello World: Qt6"); | ||
button.show(); | ||
|
||
return app.exec(); | ||
} | ||
|
||
// g++ qt6.cc $(pkg-config --cflags --libs Qt6Gui Qt6Core Qt6Widgets) -fPIC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Copyright SUSE LLC | ||
// SPDX-License-Identifier: FSFAP | ||
|
||
public class swing { | ||
public static void main(String[] args) { | ||
javax.swing.JOptionPane.showMessageDialog(null, "Hello World: Swing"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/wish | ||
|
||
# Copyright SUSE LLC | ||
# SPDX-License-Identifier: FSFAP | ||
|
||
tk scaling 1.0 | ||
image create photo logo -file $tk_library/demos/images/tcllogo.gif | ||
label .hello -compound bottom -text "Hello World: Tcl/Tk" -image logo | ||
pack .hello |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/wish | ||
|
||
label .hello -text "Hello World: Tcl/Tk" | ||
pack .hello |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# SUSE's openQA tests | ||
# | ||
# Copyright SUSE LLC | ||
# SPDX-License-Identifier: FSFAP | ||
|
||
# Summary: Test UI toolkit: GTK4 | ||
# Maintainer: Dominik Heidler <dheidler@suse.de> | ||
|
||
use base 'x11test'; | ||
use strict; | ||
use warnings; | ||
use testapi; | ||
|
||
sub run { | ||
select_console 'x11'; | ||
|
||
x11_start_program('xterm'); | ||
assert_script_run 'cd data/toolkits'; | ||
|
||
assert_script_run 'make gtk4'; | ||
script_run './gtk4', 0; | ||
assert_screen 'ui-toolkit-gtk4'; | ||
wait_screen_change { send_key 'alt-f4' }; | ||
|
||
assert_script_run '$(exit $?)'; | ||
enter_cmd 'exit'; | ||
} | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.