Re: GTK test with koji

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



No sorry. I don't know what Xvfb does for focus - you may have to run a window manager to get newly mapped windows focused. X defaults to pointer-root, I believe


On Thu, Mar 22, 2018 at 7:15 AM Takao Fujiwara <fujiwara@xxxxxxxxxx> wrote:
I'd like to have GTK tests with koji and rpmbuild but I cannot get the focus-in event during the koji build.

I referred the wiki page.
https://fedoraproject.org/wiki/PackageMaintainers/GraphicalTests

Added BuildRequires of xorg-x11-server-Xvfb and gtk3-devel in my spec file.

+BuildRequires:  xorg-x11-server-Xvfb
+BuildRequires:  gtk3-devel

Added the run program in %check in my spec file.

+gcc -o test %SOURCE1 `pkg-config --cflags --libs gtk+-3.0` -g
+xvfb-run ./test

Do you have any ideas?

I added the following test code.

-------- >8 ===============
#include <gtk/gtk.h>

#define TEST_STR "test"

static void
entry_focus_in_event_cb (GtkEntry *entry,
                          gpointer  user_data)
{
     g_warning ("FOCUS_IN");
     gtk_entry_set_text (entry, TEST_STR);
}

static void
buffer_inserted_text_cb (GtkEntryBuffer *buffer,
                          guint           position,
                          const gchar    *chars,
                          guint           n_chars,
                          gpointer        user_data)
{
     g_warning ("INSERTED_TEXT");
     g_assert_cmpstr (chars, ==, TEST_STR);
     gtk_main_quit ();
}

int
main (int argc, char* argv[])
{
     GtkWidget *window;
     GtkWidget *box;
     GtkWidget *entry;
     GtkEntryBuffer *buffer;

     gtk_init (&argc, &argv);
     window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
     box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
     gtk_container_add (GTK_CONTAINER (window), box);
     entry = gtk_entry_new ();
     g_signal_connect (G_OBJECT (entry), "focus-in-event",
                       G_CALLBACK (entry_focus_in_event_cb), NULL);
     buffer = gtk_entry_get_buffer (GTK_ENTRY (entry));
     g_signal_connect (G_OBJECT (buffer), "inserted-text",
                       G_CALLBACK (buffer_inserted_text_cb), NULL);
     gtk_container_add (GTK_CONTAINER (box), entry);
     gtk_widget_show_all (window);

     gtk_main ();
     return 0;
}
------------- >8 ======================
_______________________________________________
desktop mailing list -- desktop@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to desktop-leave@xxxxxxxxxxxxxxxxxxxxxxx
_______________________________________________
desktop mailing list -- desktop@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to desktop-leave@xxxxxxxxxxxxxxxxxxxxxxx

[Index of Archives]     [Fedora Users]     [Fedora KDE]     [Fedora Announce]     [Fedora Docs]     [Fedora Config]     [PAM]     [Red Hat Development]     [Red Hat 9]     [Gimp]     [Yosemite News]

  Powered by Linux