d476a7b529841c54673075a69a7b6529d7463b8a
[chise/ruby.git] / test / org-test-kage.rb
1 #!/usr/bin/env ruby
2 # Copyright (C) 2002-2004 Kouichirou Eto, All rights reserved.
3 # kage testcase by eto 2003-0318
4
5 require "common"
6 #require "chise/stroke"
7 #include StrokeFont
8
9 #class TestKage < Test::Unit::TestCase
10 class TestKage
11   def setup
12     @kage = KageFont.new
13   end
14
15   def test_stroke
16   end
17
18   def test_kage
19     char = Character.get(0x4e03) #δΈƒ
20     font = @kage.get(0x4e03)
21     assert_instance_of(KageGlyph, font)
22     font.parse
23
24     svg = <<"EOT"
25       M 50,540 950,255 
26       M 330,50 330,900 M 330,900 Q 330,950 380,950 M 380,950 840,950 M 840,950 Q 890,950 915,850 
27 EOT
28     strokes = KageParser.parse(svg)
29     #p strokes
30   end
31
32   def test_path
33     pr = PathResolver.new
34     assert_equal([[0, 0, 1000, 1000]], pr.parse("M 0,0 1000,1000"))
35     assert_equal([[0, 0, 0, 1000], [0, 1000, 1000, 1000]], pr.parse("M 0,0 0,1000 1000,1000"))
36 #    assert_equal([[0, 0, 0.0, 0.0], [0.0, 0.0, 62.5, 437.5], [62.5, 437.5, 250.0, 750.0], [250.0, 750.0, 562.5, 937.5]], pr.parse("M 0,0 Q 0,1000 1000,1000"))
37   end
38
39 end