#!/usr/bin/perl -w use strict; use FindBin qw($Bin); use Test::More tests => 10; SKIP: { eval { require Image::Size }; if($@) { skip("all tests: could not load Image::Size", 6); } use_ok('Rose::HTML::Image'); my $image = Rose::HTML::Image->new( document_root => $Bin, src => '/logo.png'); ok(ref $image eq 'Rose::HTML::Image', 'new()'); is($image->html, '', 'html() 1'); is($image->xhtml, '', 'xhtml_field() 1'); $image->class('foo'); $image->id('bar'); $image->style('baz'); $image->alt('logo'); is($image->html, 'logo', 'html() 2'); is($image->xhtml, 'logo', 'xhtml() 2'); $image = Rose::HTML::Image->new( src => '/logo.png', document_root => $Bin); is($image->html, '', 'html() 3'); is($image->xhtml, '', 'xhtml_field() 3'); $image = Rose::HTML::Image->new(src => '/logo.png'); $image->document_root($Bin); is($image->html, '', 'html() 4'); is($image->xhtml, '', 'xhtml_field() 4'); }