[cairo-commit] rcairo/test test_constants.rb, 1.1, 1.2 test_font_face.rb, 1.4, 1.5 test_font_options.rb, 1.1, 1.2 test_scaled_font.rb, 1.2, 1.3 test_text_to_glyphs_data.rb, 1.1, 1.2

Kouhei Sutou commit at pdx.freedesktop.org
Fri Sep 19 05:56:30 PDT 2008


Committed by: kou

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

Modified Files:
	test_constants.rb test_font_face.rb test_font_options.rb 
	test_scaled_font.rb test_text_to_glyphs_data.rb 
Log Message:
* src/, test/: support cairo 1.7.6.


Index: test_constants.rb
===================================================================
RCS file: /cvs/cairo/rcairo/test/test_constants.rb,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- test_constants.rb	13 Aug 2008 12:05:30 -0000	1.1
+++ test_constants.rb	19 Sep 2008 12:56:28 -0000	1.2
@@ -1,19 +1,16 @@
 require 'cairo'
 
 class ConstantsTest < Test::Unit::TestCase
-  def test_lcd_filter
-    constant_name = "LCDFilter"
-    unless Cairo.satisfied_version?(1, 7, 2)
+  def test_text_cluster_flags
+    constant_name = "TextClusterFlag"
+    unless Cairo.satisfied_version?(1, 7, 6)
       assert_false(Cairo.const_defined?(constant_name))
       return
     end
 
     assert_true(Cairo.const_defined?(constant_name))
-    assert_equal((0..4).to_a,
-                 [Cairo::LCDFilter::DEFAULT,
-                  Cairo::LCDFilter::NONE,
-                  Cairo::LCDFilter::INTRA_PIXEL,
-                  Cairo::LCDFilter::FIR3,
-                  Cairo::LCDFilter::FIR5])
+    assert_equal((0..1).to_a,
+                 [0,
+                  Cairo::TextClusterFlag::BACKWARD])
   end
 end

Index: test_font_face.rb
===================================================================
RCS file: /cvs/cairo/rcairo/test/test_font_face.rb,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- test_font_face.rb	17 Aug 2008 07:21:42 -0000	1.4
+++ test_font_face.rb	19 Sep 2008 12:56:28 -0000	1.5
@@ -54,7 +54,7 @@
                                         Cairo::Matrix.identity,
                                         Cairo::Matrix.identity,
                                         Cairo::FontOptions.new)
-    assert_equal([[], [], false],
+    assert_equal([[], [], 0],
                  scaled_font.text_to_glyphs(0, 0, "text"))
   end
 
@@ -77,7 +77,7 @@
     face.on_text_to_glyphs do |*args|
       text_to_glyphs_args << args
       scaled_font, utf8, data = args
-      data.backward = true
+      data.cluster_flags = :backward
     end
 
     unicode_to_glyph_args = []
@@ -102,7 +102,7 @@
                    [Cairo::ScaledFont, ?e],
                    [Cairo::ScaledFont, ?x],
                    [Cairo::ScaledFont, ?t]],
-                  [[], [], true]],
+                  [[], [], Cairo::TextClusterFlag::BACKWARD]],
                  [classify_cairo_object(init_args),
                   classify_cairo_object(render_glyph_args),
                   classify_cairo_object(text_to_glyphs_args),
@@ -133,7 +133,7 @@
       def text_to_glyphs(*args)
         @text_to_glyphs_args << args
         scaled_font, utf8, data = args
-        data.backward = true
+        data.cluster_flags = :backward
       end
 
       def unicode_to_glyph(*args)
@@ -164,7 +164,7 @@
                    [Cairo::ScaledFont, ?e],
                    [Cairo::ScaledFont, ?x],
                    [Cairo::ScaledFont, ?t]],
-                  [[], [], true]],
+                  [[], [], Cairo::TextClusterFlag::BACKWARD]],
                  [classify_cairo_object(face.init_args),
                   classify_cairo_object(face.render_glyph_args),
                   classify_cairo_object(face.text_to_glyphs_args),
@@ -191,7 +191,7 @@
     face.on_text_to_glyphs do |*args|
       text_to_glyphs_args << args
       scaled_font, utf8, data = args
-      data.backward = true
+      data.cluster_flags = :backward
     end
 
     unicode_to_glyph_args = []
@@ -220,7 +220,7 @@
                   [],
                   [],
                   [],
-                  [[], [], true]],
+                  [[], [], Cairo::TextClusterFlag::BACKWARD]],
                  [classify_cairo_object(init_args),
                   classify_cairo_object(render_glyph_args),
                   classify_cairo_object(text_to_glyphs_args),

Index: test_font_options.rb
===================================================================
RCS file: /cvs/cairo/rcairo/test/test_font_options.rb,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- test_font_options.rb	13 Aug 2008 12:27:40 -0000	1.1
+++ test_font_options.rb	19 Sep 2008 12:56:28 -0000	1.2
@@ -7,26 +7,7 @@
     @options = Cairo::FontOptions.new
   end
 
-  def test_lcd_filter
-    only_cairo_version(1, 7, 2)
-
-    assert_equal(Cairo::LCDFilter::DEFAULT, @options.lcd_filter)
-    @options.lcd_filter = :fir3
-    assert_equal(Cairo::LCDFilter::FIR3, @options.lcd_filter)
-
-    assert_invalid_lcd_filter(Cairo::LCDFilter::DEFAULT - 1)
-    assert_invalid_lcd_filter(Cairo::LCDFilter::FIR5 + 1)
-  end
-
-  def assert_invalid_lcd_filter(value)
-    options = Cairo::FontOptions.new
-    exception = assert_raise(ArgumentError) do
-      options.lcd_filter = value
-    end
-    min = Cairo::LCDFilter::DEFAULT
-    max = Cairo::LCDFilter::FIR5
-    assert_equal("invalid lcd_filter: #{value} " +
-                 "(expect #{min} <= lcd_filter <= #{max})",
-                 exception.message)
+  def test_something
+    # WRITE ME!
   end
 end

Index: test_scaled_font.rb
===================================================================
RCS file: /cvs/cairo/rcairo/test/test_scaled_font.rb,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- test_scaled_font.rb	16 Aug 2008 08:16:40 -0000	1.2
+++ test_scaled_font.rb	19 Sep 2008 12:56:28 -0000	1.3
@@ -17,7 +17,7 @@
   end
 
   def test_text_to_glyphs
-    only_cairo_version(1, 7, 2)
+    only_cairo_version(1, 7, 6)
 
     surface = Cairo::PDFSurface.new(StringIO.new, 10, 10)
     context = Cairo::Context.new(surface)
@@ -27,8 +27,8 @@
                                         Cairo::FontOptions.new)
     expected_glyphs = []
     expected_clusters = []
-    expected_backward = false
-    assert_equal([expected_glyphs, expected_clusters, expected_backward],
+    expected_cluster_flags = 0
+    assert_equal([expected_glyphs, expected_clusters, expected_cluster_flags],
                  scaled_font.text_to_glyphs(0, 0, "text"))
   end
 end

Index: test_text_to_glyphs_data.rb
===================================================================
RCS file: /cvs/cairo/rcairo/test/test_text_to_glyphs_data.rb,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- test_text_to_glyphs_data.rb	17 Aug 2008 03:16:02 -0000	1.1
+++ test_text_to_glyphs_data.rb	19 Sep 2008 12:56:28 -0000	1.2
@@ -4,44 +4,48 @@
   include CairoTestUtils
 
   def test_new
-    only_cairo_version(1, 7, 2)
+    only_cairo_version(1, 7, 6)
 
     data = Cairo::UserFontFace::TextToGlyphsData.new(false, false, false)
     assert_equal([false, false, false],
-                 [data.need_glyphs?, data.need_clusters?, data.need_backward?])
+                 [data.need_glyphs?, data.need_clusters?,
+                  data.need_cluster_flags?])
 
     data = Cairo::UserFontFace::TextToGlyphsData.new(true, false, false)
     assert_equal([true, false, false],
-                 [data.need_glyphs?, data.need_clusters?, data.need_backward?])
+                 [data.need_glyphs?, data.need_clusters?,
+                  data.need_cluster_flags?])
 
     data = Cairo::UserFontFace::TextToGlyphsData.new(false, true, false)
     assert_equal([false, true, false],
-                 [data.need_glyphs?, data.need_clusters?, data.need_backward?])
+                 [data.need_glyphs?, data.need_clusters?,
+                  data.need_cluster_flags?])
 
     data = Cairo::UserFontFace::TextToGlyphsData.new(false, false, true)
     assert_equal([false, false, true],
-                 [data.need_glyphs?, data.need_clusters?, data.need_backward?])
+                 [data.need_glyphs?, data.need_clusters?,
+                  data.need_cluster_flags?])
   end
 
   def test_accessor
-    only_cairo_version(1, 7, 2)
+    only_cairo_version(1, 7, 6)
 
     data = Cairo::UserFontFace::TextToGlyphsData.new(true, true, true)
-    assert_equal([nil, nil, false],
-                 [data.glyphs, data.clusters, data.backward?])
+    assert_equal([nil, nil, 0],
+                 [data.glyphs, data.clusters, data.cluster_flags])
 
     glyph = Cairo::Glyph.new(0, 5, 10)
     data.glyphs = [glyph]
-    assert_equal([[glyph], nil, false],
-                 [data.glyphs, data.clusters, data.backward?])
+    assert_equal([[glyph], nil, 0],
+                 [data.glyphs, data.clusters, data.cluster_flags])
 
     cluster = Cairo::TextCluster.new(0, 1)
     data.clusters = [cluster]
-    assert_equal([[glyph], [cluster], false],
-                 [data.glyphs, data.clusters, data.backward?])
+    assert_equal([[glyph], [cluster], 0],
+                 [data.glyphs, data.clusters, data.cluster_flags])
 
-    data.backward = true
-    assert_equal([[glyph], [cluster], true],
-                 [data.glyphs, data.clusters, data.backward?])
+    data.cluster_flags = :backward
+    assert_equal([[glyph], [cluster], Cairo::TextClusterFlag::BACKWARD],
+                 [data.glyphs, data.clusters, data.cluster_flags])
   end
 end



More information about the cairo-commit mailing list