require File.join( File.dirname(__FILE__), "test_helper") # stdlib require 'rexml/document' # ralbum require 'ralbum/skin_engines/kwartz_skin_engine' class TestKwartzSkinEngine < Test::Unit::TestCase TEST_SKINDIR = File.join($RALBUM_HOME, "lib", "ralbum", "skins", "test_kwartz") def test_compile # TODO: le righe seguenti devono diventare skin.engine skin = Skin.new("test_kwartz", TEST_SKINDIR) skin_engine = KwartzSkinEngine.new( skin ) outputfiles = %w[ album_page.rb image_page.rb ] outputfiles.each { |f| path = File.join( skin_engine.skin.skin_dirname, "out", f ) FileUtils.rm( path ) if File.exist?(path) } skin_engine.compile outputfiles.each { |f| path = File.join( skin_engine.skin.skin_dirname, "out", f ) assert File.exist?( path ) } end def test_write_xml doc = REXML::Document.new doc << REXML::XMLDecl.new xml_project = doc.add_element( "project" ) xml_skins = xml_project.add_element( "skins" ) # TODO: lo skin engine deve essere deciso dallo skin non puo' essere istanziato a parte!!! # TODO: deve diventare skin.egine skin = Skin.new("test_kwartz", TEST_SKINDIR) skin_engine = KwartzSkinEngine.new( skin ) skin_engine.write_xml( xml_skins ) # doc.write( $stdout, 0 ) iss = REXML::XPath.match( doc, "//image_strategy" ) assert_equal( 2, iss.length ) xml_is = iss[0] assert_equal( "ScaledImageStrategy", xml_is.attributes["name"] ) xml_is = iss[1] assert_equal( "ScaledImageStrategy", xml_is.attributes["name"] ) end end