Sha256: 5c2e900b6ee110597edf430202c41e34fe09dfc5b13e191fc0bc59152b27cd6d

Contents?: true

Size: 1.81 KB

Versions: 2

Compression:

Stored size: 1.81 KB

Contents

# Copyright (C) 2019  Sutou Kouhei <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

class TestZabw < Test::Unit::TestCase
  include FixtureHelper

  def setup
    @decomposer = ChupaText::Decomposers::AbiWord.new({})
  end

  def fixture_path(*components)
    super("zabw", *components)
  end

  sub_test_case("target?") do
    sub_test_case("extension") do
      def create_data(uri)
        data = ChupaText::Data.new
        data.body = ""
        data.uri = uri
        data
      end

      def test_doc
        assert_true(@decomposer.target?(create_data("document.zabw")))
      end
    end
  end

  sub_test_case("decompose") do
    include DecomposeHelper

    sub_test_case("one page") do
      def test_body
        assert_equal(["Page1\n"], decompose.collect(&:body))
      end

      private
      def decompose
        super(fixture_path("one-page.zabw"))
      end
    end

    sub_test_case("multi pages") do
      def test_body
        assert_equal([<<-BODY], decompose.collect(&:body))
Page1
Page2
        BODY
      end

      private
      def decompose
        super(fixture_path("multi-pages.zabw"))
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
chupa-text-decomposer-abiword-1.0.1 test/test-zabw.rb
chupa-text-decomposer-abiword-1.0.0 test/test-zabw.rb