Back to index

bamf  0.2.120
Defines | Functions | Variables
test-window.c File Reference
#include <glib.h>
#include <stdlib.h>
#include "bamf-window.h"
#include "bamf-legacy-window.h"
#include "bamf-legacy-window-test.h"

Go to the source code of this file.

Defines

#define DOMAIN   "/Window"

Functions

static void test_allocation (void)
static void test_xid (void)
static void test_active (void)
static void test_urgent (void)
static void test_user_visible (void)
static void test_maximized (void)
static void test_vmaximized (void)
static void test_hmaximized (void)
void test_window_create_suite (void)
void on_urgent_changed (BamfWindow *window, gboolean result, gpointer pointer)
void on_active_changed (BamfWindow *window, gboolean result, gpointer pointer)
void on_user_visible_changed (BamfWindow *window, gboolean result, gpointer pointer)
void on_maximized_changed (BamfWindow *window, gint old, gint new, gpointer pointer)
void on_vmaximized_changed (BamfWindow *window, gint old, gint new, gpointer pointer)
void on_hmaximized_changed (BamfWindow *window, gint old, gint new, gpointer pointer)

Variables

static gboolean signal_seen = FALSE
static gboolean signal_result = FALSE

Define Documentation

#define DOMAIN   "/Window"

Function Documentation

void on_active_changed ( BamfWindow *  window,
gboolean  result,
gpointer  pointer 
)

Definition at line 129 of file test-window.c.

Here is the caller graph for this function:

void on_hmaximized_changed ( BamfWindow *  window,
gint  old,
gint  new,
gpointer  pointer 
)

Definition at line 286 of file test-window.c.

Here is the caller graph for this function:

void on_maximized_changed ( BamfWindow *  window,
gint  old,
gint  new,
gpointer  pointer 
)

Definition at line 207 of file test-window.c.

Here is the caller graph for this function:

void on_urgent_changed ( BamfWindow *  window,
gboolean  result,
gpointer  pointer 
)

Definition at line 90 of file test-window.c.

Here is the caller graph for this function:

void on_user_visible_changed ( BamfWindow *  window,
gboolean  result,
gpointer  pointer 
)

Definition at line 168 of file test-window.c.

Here is the caller graph for this function:

void on_vmaximized_changed ( BamfWindow *  window,
gint  old,
gint  new,
gpointer  pointer 
)

Definition at line 247 of file test-window.c.

Here is the caller graph for this function:

void test_active ( void  ) [static]

Definition at line 136 of file test-window.c.

{
  signal_seen = FALSE;

  BamfWindow *window;
  BamfLegacyWindowTest *test;
  
  test = bamf_legacy_window_test_new (20,"Window X", "class", "exec");
  
  window = bamf_window_new (BAMF_LEGACY_WINDOW (test));
  g_signal_connect (G_OBJECT (window), "active-changed", (GCallback) on_active_changed, NULL);
  
  g_assert (!bamf_view_is_active (BAMF_VIEW (window)));
  g_assert (!signal_seen);
  
  bamf_legacy_window_test_set_active (test, TRUE);  
  g_assert (bamf_view_is_active (BAMF_VIEW (window)));
  g_assert (signal_seen);
  g_assert (signal_result);
  
  signal_seen = FALSE;
  
  bamf_legacy_window_test_set_active (test, FALSE);  
  g_assert (!bamf_view_is_active (BAMF_VIEW (window)));
  g_assert (signal_seen);
  g_assert (!signal_result);
  
  g_object_unref (window);
  g_object_unref (test);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void test_allocation ( void  ) [static]

Definition at line 55 of file test-window.c.

{
  BamfWindow *window;
  BamfLegacyWindowTest *test;
  
  test = bamf_legacy_window_test_new (20,"Window X", "class", "exec");
  
  window = bamf_window_new (BAMF_LEGACY_WINDOW (test));
  
  g_assert (BAMF_IS_WINDOW (window));
  
  g_object_unref (window);
  
  g_assert (!BAMF_IS_WINDOW (window));
  
  g_object_unref (test);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void test_hmaximized ( void  ) [static]

Definition at line 293 of file test-window.c.

{
  signal_seen = FALSE;

  BamfWindow *window;
  BamfLegacyWindowTest *test;

  test = bamf_legacy_window_test_new (20,"Maximized Window X", "class", "exec");

  window = bamf_window_new (BAMF_LEGACY_WINDOW (test));
  g_signal_connect (G_OBJECT (window), "maximized-changed", (GCallback) on_hmaximized_changed, NULL);

  g_assert (bamf_window_maximized (window) == BAMF_WINDOW_FLOATING);
  g_assert (!signal_seen);

  bamf_legacy_window_test_set_maximized (test, BAMF_WINDOW_HORIZONTAL_MAXIMIZED);  
  g_assert (bamf_window_maximized (window) == BAMF_WINDOW_HORIZONTAL_MAXIMIZED);
  g_assert (signal_seen);
  g_assert (signal_result);
  
  signal_seen = FALSE;

  bamf_legacy_window_test_set_maximized (test, BAMF_WINDOW_FLOATING);  
  g_assert (bamf_window_maximized (window) == BAMF_WINDOW_FLOATING);
  g_assert (signal_seen);
  g_assert (!signal_result);
  
  g_object_unref (window);
  g_object_unref (test);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void test_maximized ( void  ) [static]

Definition at line 215 of file test-window.c.

{
  signal_seen = FALSE;

  BamfWindow *window;
  BamfLegacyWindowTest *test;

  test = bamf_legacy_window_test_new (20,"Maximized Window X", "class", "exec");

  window = bamf_window_new (BAMF_LEGACY_WINDOW (test));
  g_signal_connect (G_OBJECT (window), "maximized-changed", (GCallback) on_maximized_changed, NULL);

  g_assert (bamf_window_maximized (window) == BAMF_WINDOW_FLOATING);
  g_assert (!signal_seen);

  bamf_legacy_window_test_set_maximized (test, BAMF_WINDOW_MAXIMIZED);  
  g_assert (bamf_window_maximized (window) == BAMF_WINDOW_MAXIMIZED);
  g_assert (signal_seen);
  g_assert (signal_result);
  
  signal_seen = FALSE;

  bamf_legacy_window_test_set_maximized (test, BAMF_WINDOW_FLOATING);  
  g_assert (bamf_window_maximized (window) == BAMF_WINDOW_FLOATING);
  g_assert (signal_seen);
  g_assert (!signal_result);
  
  g_object_unref (window);
  g_object_unref (test);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void test_urgent ( void  ) [static]

Definition at line 97 of file test-window.c.

{
  signal_seen = FALSE;

  BamfWindow *window;
  BamfLegacyWindowTest *test;
  
  test = bamf_legacy_window_test_new (20,"Window X", "class", "exec");
  
  window = bamf_window_new (BAMF_LEGACY_WINDOW (test));
  g_signal_connect (G_OBJECT (window), "urgent-changed", (GCallback) on_urgent_changed, NULL);
  
  g_assert (!bamf_view_is_urgent (BAMF_VIEW (window)));
  g_assert (!signal_seen);
  
  bamf_legacy_window_test_set_attention (test, TRUE);  
  g_assert (bamf_view_is_urgent (BAMF_VIEW (window)));
  g_assert (signal_seen);
  g_assert (signal_result);
  
  signal_seen = FALSE;
  
  bamf_legacy_window_test_set_attention (test, FALSE);  
  g_assert (!bamf_view_is_urgent (BAMF_VIEW (window)));
  g_assert (signal_seen);
  g_assert (!signal_result);
  
  g_object_unref (window);
  g_object_unref (test);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void test_user_visible ( void  ) [static]

Definition at line 175 of file test-window.c.

{
  signal_seen = FALSE;

  BamfWindow *window;
  BamfLegacyWindowTest *test;
  
  test = bamf_legacy_window_test_new (20,"Window X", "class", "exec");
  
  window = bamf_window_new (BAMF_LEGACY_WINDOW (test));
  g_signal_connect (G_OBJECT (window), "user-visible-changed", (GCallback) on_user_visible_changed, NULL);
  
  g_assert (bamf_view_user_visible (BAMF_VIEW (window)));
  g_assert (!signal_seen);
  
  bamf_legacy_window_test_set_skip (test, TRUE);  
  g_assert (!bamf_view_user_visible (BAMF_VIEW (window)));
  g_assert (signal_seen);
  g_assert (!signal_result);
  
  signal_seen = FALSE;
  
  bamf_legacy_window_test_set_skip (test, FALSE);  
  g_assert (bamf_view_user_visible (BAMF_VIEW (window)));
  g_assert (signal_seen);
  g_assert (signal_result);
  
  g_object_unref (window);
  g_object_unref (test);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void test_vmaximized ( void  ) [static]

Definition at line 254 of file test-window.c.

{
  signal_seen = FALSE;

  BamfWindow *window;
  BamfLegacyWindowTest *test;

  test = bamf_legacy_window_test_new (20,"Maximized Window X", "class", "exec");

  window = bamf_window_new (BAMF_LEGACY_WINDOW (test));
  g_signal_connect (G_OBJECT (window), "maximized-changed", (GCallback) on_vmaximized_changed, NULL);

  g_assert (bamf_window_maximized (window) == BAMF_WINDOW_FLOATING);
  g_assert (!signal_seen);

  bamf_legacy_window_test_set_maximized (test, BAMF_WINDOW_VERTICAL_MAXIMIZED);  
  g_assert (bamf_window_maximized (window) == BAMF_WINDOW_VERTICAL_MAXIMIZED);
  g_assert (signal_seen);
  g_assert (signal_result);
  
  signal_seen = FALSE;

  bamf_legacy_window_test_set_maximized (test, BAMF_WINDOW_FLOATING);  
  g_assert (bamf_window_maximized (window) == BAMF_WINDOW_FLOATING);
  g_assert (signal_seen);
  g_assert (!signal_result);
  
  g_object_unref (window);
  g_object_unref (test);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void test_window_create_suite ( void  )

Definition at line 40 of file test-window.c.

{
#define DOMAIN "/Window"

  g_test_add_func (DOMAIN"/Allocation", test_allocation);
  g_test_add_func (DOMAIN"/Xid", test_xid);
  g_test_add_func (DOMAIN"/Events/Active", test_active);
  g_test_add_func (DOMAIN"/Events/Urgent", test_urgent);
  g_test_add_func (DOMAIN"/Events/UserVisible", test_user_visible);
  g_test_add_func (DOMAIN"/Events/Maximized", test_maximized);
  g_test_add_func (DOMAIN"/Events/VerticallyMaximized", test_vmaximized);
  g_test_add_func (DOMAIN"/Events/HorizontallyMaximized", test_hmaximized);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void test_xid ( void  ) [static]

Definition at line 74 of file test-window.c.

{
  BamfWindow *window;
  BamfLegacyWindowTest *test;
  
  test = bamf_legacy_window_test_new (20,"Window X", "class", "exec");
  
  window = bamf_window_new (BAMF_LEGACY_WINDOW (test));

  g_assert (bamf_window_get_xid (window) == 20);  
  
  g_object_unref (window);
  g_object_unref (test);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

gboolean signal_result = FALSE [static]

Definition at line 37 of file test-window.c.

gboolean signal_seen = FALSE [static]

Definition at line 36 of file test-window.c.