From: Keith Fahlgren Date: Mon, 23 Jun 2008 16:12:10 +0000 (+0000) Subject: Removing testdocs svn:external X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=65b270debc3381dfcb365fef9e5f783cb3296cd9;p=docbook-dsssl Removing testdocs svn:external --- diff --git a/xsl/epub/bin/spec/epub_regressions_spec.rb b/xsl/epub/bin/spec/epub_regressions_spec.rb index 1d1ed137c..b34db8ad8 100755 --- a/xsl/epub/bin/spec/epub_regressions_spec.rb +++ b/xsl/epub/bin/spec/epub_regressions_spec.rb @@ -20,7 +20,7 @@ $DEBUG = false describe DocBook::Epub do before(:all) do @filedir = File.expand_path(File.join(File.dirname(__FILE__), 'files')) - @testdocsdir = File.expand_path(File.join(File.dirname(__FILE__), 'testdocs')) + @testdocsdir = File.expand_path(File.join(ENV['DOCBOOK_SVN'], 'testdocs')) @tmpdir = File.join(Dir::tmpdir(), "epubregressions"); Dir.mkdir(@tmpdir) rescue Errno::EEXIST end diff --git a/xsl/epub/bin/spec/epub_small_smoketest.rb b/xsl/epub/bin/spec/epub_small_smoketest.rb index 28dd78748..a2feac678 100755 --- a/xsl/epub/bin/spec/epub_small_smoketest.rb +++ b/xsl/epub/bin/spec/epub_small_smoketest.rb @@ -16,7 +16,7 @@ require 'docbook' $DEBUG = false -TESTDOCSDIR = File.expand_path(File.join(File.dirname(__FILE__), 'testdocs')) +TESTDOCSDIR = File.expand_path(File.join(ENV['DOCBOOK_SVN'], 'testdocs')) NUMBER_TO_TEST = 15 describe DocBook::Epub do diff --git a/xsl/epub/bin/spec/epub_smoketest_spec.rb b/xsl/epub/bin/spec/epub_smoketest_spec.rb index 6efad0d00..27f389cf3 100755 --- a/xsl/epub/bin/spec/epub_smoketest_spec.rb +++ b/xsl/epub/bin/spec/epub_smoketest_spec.rb @@ -17,7 +17,7 @@ require 'docbook' $DEBUG = false -TESTDOCSDIR = File.expand_path(File.join(File.dirname(__FILE__), 'testdocs')) +TESTDOCSDIR = File.expand_path(File.join(ENV['DOCBOOK_SVN'], 'testdocs')) describe DocBook::Epub do diff --git a/xsl/epub/bin/spec/epub_spec.rb b/xsl/epub/bin/spec/epub_spec.rb index 429040ebc..f5a90492b 100755 --- a/xsl/epub/bin/spec/epub_spec.rb +++ b/xsl/epub/bin/spec/epub_spec.rb @@ -19,11 +19,14 @@ $DEBUG = false describe DocBook::Epub do before(:all) do @filedir = File.expand_path(File.join(File.dirname(__FILE__), 'files')) - @testdocsdir = File.expand_path(File.join(File.dirname(__FILE__), 'testdocs')) + @testdocsdir = File.expand_path(File.join(ENV['DOCBOOK_SVN'], 'testdocs')) exampledir = File.expand_path(File.join(File.dirname(__FILE__), 'examples')) @valid_epub = File.join(exampledir, "AMasqueOfDays.epub") @tmpdir = File.join(Dir::tmpdir(), "epubspec"); Dir.mkdir(@tmpdir) rescue Errno::EEXIST + @css_file_base = "test.css" + @css_file = File.join(@filedir, @css_file_base) + @simple_bookfile = File.join(@testdocsdir, "book.001.xml") @simple_epub = DocBook::Epub.new(@simple_bookfile, @tmpdir) @simple_epubfile = File.join(@tmpdir, "testepub.epub") @@ -142,6 +145,46 @@ describe DocBook::Epub do end end + it "should include a CSS link in HTML files when CSS files have been provided" do + begin + tmpdir = File.join(Dir::tmpdir(), "epubcsshtmltest"); Dir.mkdir(tmpdir) rescue Errno::EEXIST + + epub = DocBook::Epub.new(File.join(@testdocsdir, "book.002.xml"), @tmpdir, @css_file) + epubfile = File.join(tmpdir, "csslink.epub") + epub.render_to_file(epubfile, $DEBUG) + + success = system("unzip -q -d #{File.expand_path(tmpdir)} -o #{epubfile}") + raise "Could not unzip #{epubfile}" unless success + html_files = Dir.glob(File.join(tmpdir, "**", "*.html")) + html_links = html_files.find_all {|html_file| File.open(html_file).readlines.to_s =~ /]*#{@css_file_base}/} + html_links.size.should == html_files.size + rescue => e + raise e + ensure + FileUtils.rm_r(tmpdir, :force => true) + end + end + + it "should include a CSS link in OPF file when CSS files have been provided" do + begin + tmpdir = File.join(Dir::tmpdir(), "epubcsshtmltest"); Dir.mkdir(tmpdir) rescue Errno::EEXIST + + epub = DocBook::Epub.new(File.join(@testdocsdir, "book.002.xml"), @tmpdir, @css_file) + epubfile = File.join(tmpdir, "csslink.epub") + epub.render_to_file(epubfile, $DEBUG) + + success = system("unzip -q -d #{File.expand_path(tmpdir)} -o #{epubfile}") + raise "Could not unzip #{epubfile}" unless success + opf_files = Dir.glob(File.join(tmpdir, "**", "*.opf")) + opf_links = opf_files.find_all {|opf_file| File.open(opf_file).readlines.to_s =~ /]*#{@css_file_base}/} + opf_links.size.should == opf_files.size + rescue => e + raise e + ensure + FileUtils.rm_r(tmpdir, :force => true) + end + end + it "should include a TOC link in rendered epub files for s" do begin tmpdir = File.join(Dir::tmpdir(), "epubtoctest"); Dir.mkdir(tmpdir) rescue Errno::EEXIST