summaryrefslogtreecommitdiffhomepage
path: root/test/doc_props/tc_app.rb
blob: fbbe0b678b189b89107cf0b0db176dd869690278 (plain)
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
35
36
37
38
39
40
41
42
43
44
require 'tc_helper'

class TestApp < Test::Unit::TestCase
  def setup
    options = {
      :Template => 'Foo.xlt',
      :Manager => 'Penny',
      :Company => "Bob's Repair",
      :Pages => 1,
      :Words => 2,
      :Characters => 7,
      :PresentationFormat => 'any',
      :Lines => 1,
      :Paragraphs => 1,
      :Slides => 4,
      :Notes => 1,
      :TotalTime => 2,
      :HidddenSlides => 3,
      :MMClips => 10,
      :ScaleCrop => true,
      :LinksUpToDate => true,
      :CharactersWithSpaces => 9,
      :SharedDoc => false,
      :HyperlinkBase => 'foo',
      :HyperlInksChanged => false,
      :Application => 'axlsx',
      :AppVersion => '1.1.5',
      :DocSecurity => 0
    }

    @app = Axlsx::App.new options
  end

  def test_valid_document
    schema = Nokogiri::XML::Schema(File.open(Axlsx::APP_XSD))
    doc = Nokogiri::XML(@app.to_xml_string)
    errors = []
    schema.validate(doc).each do |error|
      errors << error
    end

    assert_equal(0, errors.size, "app.xml invalid" + errors.map(&:message).to_s)
  end
end