void cut_setup (void) { const gchar *dir = g_getenv("BASE_DIR"); dir = dir ? dir : "."; cut_set_fixture_data_dir(dir, "fixtures", NULL); docset001_path = cut_take_string(cut_build_fixture_data_path("docset001.txt", NULL)); docset002_path = cut_take_string(cut_build_fixture_data_path("docset002.txt", NULL)); doc = NULL; docset = NULL; pool = NULL; }
static const gchar * build_uri (const gchar *fixture_data_component) { gchar *uri, *path; path = cut_build_fixture_data_path (fixture_data_component, NULL); uri = g_strconcat ("file://", path, NULL); g_free (path); return cut_take_string (uri); }
static GdkPixbuf * load_pixbuf (const gchar *path) { GdkPixbuf *pixbuf; GError *error = NULL; gchar *pixbuf_path; pixbuf_path = cut_build_fixture_data_path(path, NULL); pixbuf = gdk_pixbuf_new_from_file(pixbuf_path, &error); g_free(pixbuf_path); gcut_assert_error(error); return pixbuf; }
void test_new_from_data (void) { GError *error = NULL; gchar *data; gsize length; const gchar *path; path = cut_take_string (cut_build_fixture_data_path ("multi-pages.pdf", NULL)); g_file_get_contents (path, &data, &length, &error); gcut_assert_error (error); document = poppler_document_new_from_data (data, length, NULL, &error); g_free (data); gcut_assert_error (error); cut_assert_equal_int (3, poppler_document_get_n_pages (document)); }