File: test_xml_surface.rb

package info (click to toggle)
ruby-cairo 1.17.13-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,532 kB
  • sloc: ruby: 11,997; ansic: 10,183; sh: 48; makefile: 4
file content (34 lines) | stat: -rw-r--r-- 814 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
class XMLSurfaceTest < Test::Unit::TestCase
  include Helper

  def setup
    only_surface("XML")
  end

  def test_new
    only_cairo_version(1, 12, 0)
    output = StringIO.new
    device = Cairo::XMLDevice.new(output)
    surface = Cairo::XMLSurface.new(device, 100, 200)
    Cairo::Context.create(surface) do |context|
      context.move_to(15, 30)
      context.line_to(80, 100)
      context.stroke
    end
    assert_equal(<<-EOX, output.string)
<stroke>
  <operator>OVER</operator>
  <line-width>2</line-width>
  <miter-limit>10</miter-limit>
  <line-cap>LINE_CAP_BUTT</line-cap>
  <line-join>LINE_JOIN_MITER</line-join>
  <source-pattern>
    <solid>0 0 0 1</solid>
  </source-pattern>
  <path> 15 30 m 80 100 l</path>
  <tolerance>0.1</tolerance>
  <antialias>DEFAULT</antialias>
</stroke>
EOX
  end
end