[cairo-commit] rcairo/test test_context.rb, 1.5, 1.6 test_font_face.rb, 1.3, 1.4 test_surface.rb, 1.3, 1.4

Kouhei Sutou commit at pdx.freedesktop.org
Sun Aug 17 00:21:45 PDT 2008


Committed by: kou

Update of /cvs/cairo/rcairo/test
In directory kemper:/tmp/cvs-serv30288/test

Modified Files:
	test_context.rb test_font_face.rb test_surface.rb 
Log Message:
* src/, test/: add missing version checks.


Index: test_context.rb
===================================================================
RCS file: /cvs/cairo/rcairo/test/test_context.rb,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- test_context.rb	17 Aug 2008 03:00:41 -0000	1.5
+++ test_context.rb	17 Aug 2008 07:21:42 -0000	1.6
@@ -34,6 +34,8 @@
   end
 
   def test_font_face
+    only_cairo_version(1, 7, 2)
+
     context = Cairo::Context.new(@surface)
 
     assert_kind_of(Cairo::FontFace, context.font_face)
@@ -77,6 +79,8 @@
   end
 
   def test_select_font_face
+    only_cairo_version(1, 7, 2)
+
     context = Cairo::Context.new(@surface)
 
     face = context.font_face

Index: test_font_face.rb
===================================================================
RCS file: /cvs/cairo/rcairo/test/test_font_face.rb,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- test_font_face.rb	17 Aug 2008 03:00:41 -0000	1.3
+++ test_font_face.rb	17 Aug 2008 07:21:42 -0000	1.4
@@ -110,35 +110,37 @@
                   result])
   end
 
-  class CustomUserFontFace < Cairo::UserFontFace
-    attr_reader :init_args, :render_glyph_args
-    attr_reader :text_to_glyphs_args, :unicode_to_glyph_args
-    def initialize
-      super
-      @init_args = []
-      @render_glyph_args = []
-      @text_to_glyphs_args = []
-      @unicode_to_glyph_args = []
-    end
+  if Cairo.satisfied_version?(1, 7, 2)
+    class CustomUserFontFace < Cairo::UserFontFace
+      attr_reader :init_args, :render_glyph_args
+      attr_reader :text_to_glyphs_args, :unicode_to_glyph_args
+      def initialize
+        super
+        @init_args = []
+        @render_glyph_args = []
+        @text_to_glyphs_args = []
+        @unicode_to_glyph_args = []
+      end
 
-    def init(*args)
-      @init_args << args
-    end
+      def init(*args)
+        @init_args << args
+      end
 
-    def render_glyph(*args)
-      @render_glyph_args << args
-    end
+      def render_glyph(*args)
+        @render_glyph_args << args
+      end
 
-    def text_to_glyphs(*args)
-      @text_to_glyphs_args << args
-      scaled_font, utf8, data = args
-      data.backward = true
-    end
+      def text_to_glyphs(*args)
+        @text_to_glyphs_args << args
+        scaled_font, utf8, data = args
+        data.backward = true
+      end
 
-    def unicode_to_glyph(*args)
-      @unicode_to_glyph_args << args
-      scaled_font, unicode = args
-      unicode
+      def unicode_to_glyph(*args)
+        @unicode_to_glyph_args << args
+        scaled_font, unicode = args
+        unicode
+      end
     end
   end
 

Index: test_surface.rb
===================================================================
RCS file: /cvs/cairo/rcairo/test/test_surface.rb,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- test_surface.rb	14 Aug 2008 12:37:51 -0000	1.3
+++ test_surface.rb	17 Aug 2008 07:21:43 -0000	1.4
@@ -29,11 +29,12 @@
   end
 
   def test_fallback_resolution
+    only_cairo_version(1, 7, 2)
+
     surface = Cairo::ImageSurface.new(100, 100)
 
     assert_equal([300.0, 300.0], surface.fallback_resolution)
 
-    only_cairo_version(1, 7, 2)
     surface.set_fallback_resolution(95, 95)
     assert_equal([95.0, 95.0], surface.fallback_resolution)
   end



More information about the cairo-commit mailing list