summaryrefslogtreecommitdiff
path: root/test/test-application.c
blob: 7f291b1cbe3b2d2f782729609017ce880b342a5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* Copyright 2013 Endless Mobile, Inc. */

#include <stdlib.h>
#include <gtk/gtk.h>
#include <endless/endless.h>

#include "run-tests.h"

#define EXPECTED_TWO_WINDOW_ERRMSG "*You should not add more than one application window*"

static void
test_two_windows (EosApplication *app)
{
  GtkWidget *win1 = eos_window_new (app);

  /* Unix-only test */
  if (g_test_trap_fork(0 /* timeout */, G_TEST_TRAP_SILENCE_STDERR))
    {
      GtkWidget *win2 = eos_window_new (app);
      gtk_widget_destroy (win2);
      exit (0);
    }

  g_test_trap_assert_failed ();
  g_test_trap_assert_stderr (EXPECTED_TWO_WINDOW_ERRMSG);

  gtk_widget_destroy (win1);
}

void
add_application_tests (void)
{
  ADD_APP_WINDOW_TEST ("/application/two-windows", test_two_windows);
}