static void add_viewer_viewerAdded(void **state) { OnlineTv_t tv = onlineTv_new(); viewer_t v1 = viewer_new(tv, "dfged"); viewer_t v2 = viewer_new(tv, "df"); viewer_t v3 = viewer_new(tv, "dfgsdfded"); viewer_add(tv,v1); viewer_add(tv, v2); viewer_add(tv, v3); viewer_delete(tv, 2); assert_int_equal(onlineTv_getViewerCount(tv), 2); viewer_free(v1); viewer_free(v2); viewer_free(v3); onlineTv_free(tv); }
static void new_void_tvCreated(void **state) { OnlineTv_t tv = onlineTv_new(); viewer_t v = viewer_new(tv, "dfged"); assert_non_null(v); viewer_free(v); onlineTv_free(tv); }
static void add_viewerName_nameIsValid(void **state) { OnlineTv_t tv = onlineTv_new(); viewer_t v = viewer_new(tv, "Armenak_cool_chuvak"); viewer_add(tv, v); assert_string_equal(viewer_getName(v), "Armenak_cool_chuvak"); viewer_free(v); onlineTv_free(tv); }
int viewer_show() { GApplication* viewer = viewer_new(); GtkWidget *window = NULL; GtkBuilder* builder; GError* error = NULL; /* Load UI from file */ builder = gtk_builder_new(); if (!gtk_builder_add_from_file(builder, UI_FILE, &error)) { g_critical("Couldn't load builder file: %s", error->message); g_error_free(error); return 1; } /* Connect signal handlers */ gtk_builder_connect_signals(builder, viewer); /* Get the window object from the ui file */ window = viewer_get_window(builder); if (!window) { g_critical("Widget \"%s\" is missing in file %s.", TOP_WINDOW, UI_FILE); return 1; } g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(gtk_main_quit), NULL); /* Widgets initialization for viewer.ui - DO NOT REMOVE */ window_init(GTK_WINDOW(window), builder); g_object_unref(builder); /* Enter the main loop */ gtk_widget_show_all(window); return 0; }