dia r4109 - in trunk: . app objects/standard tests



Author: hans
Date: Sun Aug 10 17:00:12 2008
New Revision: 4109
URL: http://svn.gnome.org/viewvc/dia?rev=4109&view=rev

Log:
2008-08-10  Hans Breuer  <hans breuer org>

	* app/layer_dialog.c : don't access layer_dialog while not initialized
	* objects/standard/outline.c : conditionalize on CAIRO_HAS_SVG_SURFACE
	* tests/test-objects.c tests/test-boundingbox.c : conditionalize on
	GLIB_CHECK_VERSION(2,16,0) - together this make Dia compile an run on 
	a standard Dapper Drake (gtk+-2.8, glib-2.10, cairo-1.0.4)



Modified:
   trunk/ChangeLog
   trunk/app/layer_dialog.c
   trunk/objects/standard/outline.c
   trunk/tests/test-boundingbox.c
   trunk/tests/test-objects.c

Modified: trunk/app/layer_dialog.c
==============================================================================
--- trunk/app/layer_dialog.c	(original)
+++ trunk/app/layer_dialog.c	Sun Aug 10 17:00:12 2008
@@ -681,17 +681,15 @@
   int i;
   int current_nr;
 
-  if (layer_dialog->diagram_omenu == NULL)
-  {
-    return;
-  }
-
   if (layer_dialog == NULL || layer_dialog->dialog == NULL) {
     if (!dia_open_diagrams())
       return; /* shortcut; maybe session end w/o this dialog */
     else
       create_layer_dialog();
   }
+  /* oh this options: here integrated UI ;( */
+  if (!layer_dialog->diagram_omenu)
+    return;
         
   new_menu = gtk_menu_new();
 

Modified: trunk/objects/standard/outline.c
==============================================================================
--- trunk/objects/standard/outline.c	(original)
+++ trunk/objects/standard/outline.c	Sun Aug 10 17:00:12 2008
@@ -34,8 +34,10 @@
 
 #include "tool-icons.h"
 
-#include <cairo.h>
-#include <cairo-svg.h>
+#include <cairo.h>
+#ifdef CAIRO_HAS_SVG_SURFACE 
+#include <cairo-svg.h>
+#endif
 
 #define NUM_HANDLES 2
 /* Object definition */
@@ -258,8 +260,13 @@
   if (outline->path)
     cairo_path_destroy (outline->path);
   outline->path = NULL;
-  /* surface will not be used to render anything, it is just to create the cairo context */
-  surface = cairo_svg_surface_create_for_stream (write_nul, NULL, 100, 100);
+  /* surface will not be used to render anything, it is just to create the cairo context */
+#ifdef CAIRO_HAS_SVG_SURFACE
+  surface = cairo_svg_surface_create_for_stream (write_nul, NULL, 100, 100);
+#else
+  /* if only I could remember why I have choosen the svg surface in the first place */
+  surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 100, 100);
+#endif
   cr = cairo_create (surface);
   cairo_surface_destroy (surface); /* in fact: unref() */
   style = dia_font_get_style (outline->font);

Modified: trunk/tests/test-boundingbox.c
==============================================================================
--- trunk/tests/test-boundingbox.c	(original)
+++ trunk/tests/test-boundingbox.c	Sun Aug 10 17:00:12 2008
@@ -28,8 +28,9 @@
 #include <glib.h>
 #include <glib-object.h>
 
+#if GLIB_CHECK_VERSION(2,16,0)
 #include <glib/gtestutils.h>
-
+#endif
 #include "libdia.h"
 
 /*
@@ -117,7 +118,9 @@
   for (i = 0; i < num; ++i)
     {
       gchar *testpath = g_strdup_printf ("/Dia/BoundingBox/Bezier%d", i+1);
+#if GLIB_CHECK_VERSION(2,16,0)
       g_test_add_data_func (testpath, &_test_beziers[i], _check_one_bezier);
+#endif
       g_free (testpath);
     }
 }
@@ -128,11 +131,16 @@
   GList *plugins = NULL;
   int ret;
   
+#if GLIB_CHECK_VERSION(2,16,0)
   g_test_init (&argc, &argv, NULL);
   /* not really needed - or are there message_warnings in the bbox code? */
   libdia_init (DIA_MESSAGE_STDERR);
 
   _add_bezier_tests ();
 
-  return g_test_run ();
+  ret = g_test_run ();
+#else
+  g_print ("GLib version does not support g_test_*()");
+#endif
+  return ret;
 }

Modified: trunk/tests/test-objects.c
==============================================================================
--- trunk/tests/test-objects.c	(original)
+++ trunk/tests/test-objects.c	Sun Aug 10 17:00:12 2008
@@ -28,7 +28,9 @@
 #include <glib.h>
 #include <glib-object.h>
 
+#if GLIB_CHECK_VERSION(2,16,0)
 #include <glib/gtestutils.h>
+#endif
 
 #include "object.h"
 #include "plug-ins.h"
@@ -204,6 +206,7 @@
   const gchar *base = (const gchar *)user_data;
   gchar *testpath;
 
+#if GLIB_CHECK_VERSION(2,16,0)
   testpath = g_strdup_printf ("%s/%s/%s", base, name, "Creation");
   g_test_add_data_func (testpath, type, _test_creation);
   g_free (testpath);
@@ -215,6 +218,7 @@
   testpath = g_strdup_printf ("%s/%s/%s", base, name, "Modification");
   g_test_add_data_func (testpath, type, _test_modification);
   g_free (testpath);
+#endif
 
   ++num_objects;
 }
@@ -223,8 +227,9 @@
 main (int argc, char** argv)
 {
   GList *plugins = NULL;
-  int ret;
+  int ret = 0;
   
+#if GLIB_CHECK_VERSION(2,16,0)
   /* not using gtk_test_init() means we can only test non-gtk facilities of objects */
   g_type_init ();
   g_test_init (&argc, &argv, NULL);
@@ -252,5 +257,8 @@
 
   ret = g_test_run ();
   g_print ("Tested %d objects.\n", num_objects);
+#else
+  g_print ("GLib version does not support g_test_*()");
+#endif
   return ret;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]