]> granicus.if.org Git - docbook-dsssl/commitdiff
Removing testdocs svn:external
authorKeith Fahlgren <abdelazer@users.sourceforge.net>
Mon, 23 Jun 2008 16:12:10 +0000 (16:12 +0000)
committerKeith Fahlgren <abdelazer@users.sourceforge.net>
Mon, 23 Jun 2008 16:12:10 +0000 (16:12 +0000)
xsl/epub/bin/spec/epub_regressions_spec.rb
xsl/epub/bin/spec/epub_small_smoketest.rb
xsl/epub/bin/spec/epub_smoketest_spec.rb
xsl/epub/bin/spec/epub_spec.rb

index 1d1ed137c11e50d125abfe6184de4579f73fe75c..b34db8ad862063e6534713d95700e23c74c9bbbf 100755 (executable)
@@ -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
 
index 28dd78748ba362cd4632f7001e370bba746e8ab2..a2feac678f326f12351e42758f8ec7c8c4b7ea6b 100755 (executable)
@@ -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
index 6efad0d00375cfa3650a2054a3cf3b11a4ab0251..27f389cf38aa6ea05907b2b4827f8da30e6b821d 100755 (executable)
@@ -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
 
index 429040ebc2dda67217c49bb5f154d13bebd31bfa..f5a90492b8bca6c1449a61e29ca689e0dbb2bf91 100755 (executable)
@@ -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 =~ /<link [^>]*#{@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 =~ /<item [^>]*#{@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 <book>s" do
     begin
       tmpdir = File.join(Dir::tmpdir(), "epubtoctest"); Dir.mkdir(tmpdir) rescue Errno::EEXIST