[gnome-color-manager: 71/80] trivial: move GcmImage to libcolor-glib
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-color-manager: 71/80] trivial: move GcmImage to libcolor-glib
- Date: Mon, 19 Jul 2010 11:38:25 +0000 (UTC)
commit d61d8b9c7422378df483741a8a8f90cf92b14686
Author: Richard Hughes <richard hughsie com>
Date: Sun Jul 18 14:22:17 2010 +0100
trivial: move GcmImage to libcolor-glib
libcolor-glib/Makefile.am | 3 ++
{src => libcolor-glib}/gcm-image.c | 0
{src => libcolor-glib}/gcm-image.h | 4 ++
libcolor-glib/gcm-self-test.c | 67 ++++++++++++++++++++++++++++++++++++
src/Makefile.am | 2 -
src/gcm-self-test.c | 66 -----------------------------------
6 files changed, 74 insertions(+), 68 deletions(-)
---
diff --git a/libcolor-glib/Makefile.am b/libcolor-glib/Makefile.am
index 3b4ad98..3c1aae7 100644
--- a/libcolor-glib/Makefile.am
+++ b/libcolor-glib/Makefile.am
@@ -42,6 +42,7 @@ libcolor_glib_include_HEADERS = \
gcm-edid.h \
gcm-enum.h \
gcm-profile.h \
+ gcm-image.h \
gcm-profile-store.h \
gcm-dmi.h \
gcm-xserver.h \
@@ -72,6 +73,8 @@ libcolor_glib_la_SOURCES = \
gcm-profile.h \
gcm-clut.c \
gcm-clut.h \
+ gcm-image.c \
+ gcm-image.h \
gcm-ddc-client.c \
gcm-ddc-client.h \
gcm-ddc-device.c \
diff --git a/src/gcm-image.c b/libcolor-glib/gcm-image.c
similarity index 100%
rename from src/gcm-image.c
rename to libcolor-glib/gcm-image.c
diff --git a/src/gcm-image.h b/libcolor-glib/gcm-image.h
similarity index 94%
rename from src/gcm-image.h
rename to libcolor-glib/gcm-image.h
index 5c6a216..001bfa6 100644
--- a/src/gcm-image.h
+++ b/libcolor-glib/gcm-image.h
@@ -19,6 +19,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#if !defined (__LIBCOLOR_GLIB_H_INSIDE__) && !defined (LIBCOLOR_GLIB_COMPILATION)
+#error "Only <libcolor-glib.h> can be included directly."
+#endif
+
#ifndef __GCM_IMAGE_H
#define __GCM_IMAGE_H
diff --git a/libcolor-glib/gcm-self-test.c b/libcolor-glib/gcm-self-test.c
index 124163f..b0569c4 100644
--- a/libcolor-glib/gcm-self-test.c
+++ b/libcolor-glib/gcm-self-test.c
@@ -36,6 +36,7 @@
#include "gcm-clut.h"
#include "gcm-xyz.h"
#include "gcm-dmi.h"
+#include "gcm-image.h"
static void
gcm_test_common_func (void)
@@ -565,6 +566,71 @@ gcm_test_brightness_func (void)
g_object_unref (brightness);
}
+
+static void
+gcm_test_image_func (void)
+{
+ GcmImage *image;
+ GtkWidget *image_test;
+ GtkWidget *dialog;
+ GtkWidget *vbox;
+ gint response;
+ gboolean ret;
+ GcmProfile *profile;
+ GFile *file;
+
+ image = gcm_image_new ();
+ g_assert (image != NULL);
+
+ gtk_image_set_from_file (GTK_IMAGE(image), TESTDATADIR "/image-widget.png");
+
+ /* show in a dialog as an example */
+ dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, "Does color-corrected image match\nthe picture below?");
+ image_test = gtk_image_new_from_file (TESTDATADIR "/image-widget-good.png");
+ vbox = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+ gtk_box_pack_end (GTK_BOX(vbox), GTK_WIDGET(image), TRUE, TRUE, 12);
+ gtk_box_pack_end (GTK_BOX(vbox), image_test, TRUE, TRUE, 12);
+ gtk_widget_set_size_request (GTK_WIDGET(image), 300, 300);
+ gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE);
+ gtk_widget_show (GTK_WIDGET(image));
+ gtk_widget_show (image_test);
+
+ g_object_set (image,
+ "use-embedded-profile", TRUE,
+ "output-profile", NULL,
+ NULL);
+
+ response = gtk_dialog_run (GTK_DIALOG (dialog));
+ g_assert ((response == GTK_RESPONSE_YES));
+
+ gtk_image_set_from_file (GTK_IMAGE(image_test), TESTDATADIR "/image-widget-nonembed.png");
+ g_object_set (image,
+ "use-embedded-profile", FALSE,
+ NULL);
+
+ response = gtk_dialog_run (GTK_DIALOG (dialog));
+ g_assert ((response == GTK_RESPONSE_YES));
+
+ gtk_image_set_from_file (GTK_IMAGE(image_test), TESTDATADIR "/image-widget-output.png");
+ g_object_set (image,
+ "use-embedded-profile", TRUE,
+ NULL);
+
+ /* get test file */
+ profile = gcm_profile_new ();
+ file = g_file_new_for_path (TESTDATADIR "/ibm-t61.icc");
+ ret = gcm_profile_parse (profile, file, NULL);
+ g_object_unref (file);
+ g_assert (ret);
+ gcm_image_set_output_profile (image, profile);
+ g_object_unref (profile);
+
+ response = gtk_dialog_run (GTK_DIALOG (dialog));
+ g_assert ((response == GTK_RESPONSE_YES));
+
+ gtk_widget_destroy (dialog);
+}
+
int
main (int argc, char **argv)
{
@@ -586,6 +652,7 @@ main (int argc, char **argv)
g_test_add_func ("/libcolor-glib/profile_store", gcm_test_profile_store_func);
if (g_test_thorough ()) {
g_test_add_func ("/libcolor-glib/brightness", gcm_test_brightness_func);
+ g_test_add_func ("/libcolor-glib/image", gcm_test_image_func);
}
return g_test_run ();
diff --git a/src/Makefile.am b/src/Makefile.am
index 4edb75f..3483737 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -40,8 +40,6 @@ noinst_LIBRARIES = libgcmshared.a
libgcmshared_a_SOURCES = \
egg-debug.c \
egg-debug.h \
- gcm-image.c \
- gcm-image.h \
gcm-screen.c \
gcm-screen.h \
gcm-exif.c \
diff --git a/src/gcm-self-test.c b/src/gcm-self-test.c
index 1952bf3..75601fb 100644
--- a/src/gcm-self-test.c
+++ b/src/gcm-self-test.c
@@ -34,7 +34,6 @@
#include "gcm-device-xrandr.h"
#include "gcm-exif.h"
#include "gcm-gamma-widget.h"
-#include "gcm-image.h"
#include "gcm-print.h"
#include "gcm-profile.h"
#include "gcm-profile-store.h"
@@ -468,70 +467,6 @@ gcm_test_gamma_widget_func (void)
gtk_widget_destroy (dialog);
}
-static void
-gcm_test_image_func (void)
-{
- GcmImage *image;
- GtkWidget *image_test;
- GtkWidget *dialog;
- GtkWidget *vbox;
- gint response;
- gboolean ret;
- GcmProfile *profile;
- GFile *file;
-
- image = gcm_image_new ();
- g_assert (image != NULL);
-
- gtk_image_set_from_file (GTK_IMAGE(image), TESTDATADIR "/image-widget.png");
-
- /* show in a dialog as an example */
- dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, "Does color-corrected image match\nthe picture below?");
- image_test = gtk_image_new_from_file (TESTDATADIR "/image-widget-good.png");
- vbox = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
- gtk_box_pack_end (GTK_BOX(vbox), GTK_WIDGET(image), TRUE, TRUE, 12);
- gtk_box_pack_end (GTK_BOX(vbox), image_test, TRUE, TRUE, 12);
- gtk_widget_set_size_request (GTK_WIDGET(image), 300, 300);
- gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE);
- gtk_widget_show (GTK_WIDGET(image));
- gtk_widget_show (image_test);
-
- g_object_set (image,
- "use-embedded-profile", TRUE,
- "output-profile", NULL,
- NULL);
-
- response = gtk_dialog_run (GTK_DIALOG (dialog));
- g_assert ((response == GTK_RESPONSE_YES));
-
- gtk_image_set_from_file (GTK_IMAGE(image_test), TESTDATADIR "/image-widget-nonembed.png");
- g_object_set (image,
- "use-embedded-profile", FALSE,
- NULL);
-
- response = gtk_dialog_run (GTK_DIALOG (dialog));
- g_assert ((response == GTK_RESPONSE_YES));
-
- gtk_image_set_from_file (GTK_IMAGE(image_test), TESTDATADIR "/image-widget-output.png");
- g_object_set (image,
- "use-embedded-profile", TRUE,
- NULL);
-
- /* get test file */
- profile = gcm_profile_new ();
- file = g_file_new_for_path (TESTDATADIR "/ibm-t61.icc");
- ret = gcm_profile_parse (profile, file, NULL);
- g_object_unref (file);
- g_assert (ret);
- gcm_image_set_output_profile (image, profile);
- g_object_unref (profile);
-
- response = gtk_dialog_run (GTK_DIALOG (dialog));
- g_assert ((response == GTK_RESPONSE_YES));
-
- gtk_widget_destroy (dialog);
-}
-
static GPtrArray *
gcm_print_test_render_cb (GcmPrint *print, GtkPageSetup *page_setup, gpointer user_data, GError **error)
{
@@ -782,7 +717,6 @@ main (int argc, char **argv)
g_test_add_func ("/color/trc", gcm_test_trc_widget_func);
g_test_add_func ("/color/cie", gcm_test_cie_widget_func);
g_test_add_func ("/color/gamma_widget", gcm_test_gamma_widget_func);
- g_test_add_func ("/color/image", gcm_test_image_func);
}
if (g_test_slow ()) {
g_test_add_func ("/color/print", gcm_test_print_func);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]