n.c.
[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   def setup
11     @kage = KageFont.new
12   end
13
14   def test_stroke
15   end
16
17   def test_kage
18     char = Character.get(0x4e03) #δΈƒ
19     font = @kage.get(0x4e03)
20     assert_instance_of(KageGlyph, font)
21     font.parse
22
23     svg = <<"EOT"
24       M 50,540 950,255 
25       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 
26 EOT
27     strokes = KageParser.parse(svg)
28     #p strokes
29   end
30
31   def test_path
32     pr = PathResolver.new
33     assert_equal([[0, 0, 1000, 1000]], pr.parse("M 0,0 1000,1000"))
34     assert_equal([[0, 0, 0, 1000], [0, 1000, 1000, 1000]], pr.parse("M 0,0 0,1000 1000,1000"))
35 #    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"))
36   end
37
38 end