gf-ralbum 0.0.2 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -0
- data/bin/{ralbum.rb → ralbum} +1 -1
- data/example/example.sh +2 -1
- data/example/test_jalbum_phototree/jalbum-settings.jap +321 -0
- data/example/test_jalbum_phototree/src/albumfiles.txt +9 -0
- data/example/test_jalbum_phototree/src/comments.properties +0 -0
- data/example/test_jalbum_phototree/src/flowers/albumfiles.txt +14 -0
- data/example/test_jalbum_phototree/src/meta.properties +2 -0
- data/example/{test_phototree → test_rubyphoto_phototree}/album.xml +0 -0
- data/example/test_rubyphoto_phototree/flowers/IMG_1469.wt.jpg +0 -0
- data/example/test_rubyphoto_phototree/flowers/IMG_2291.jpg +0 -0
- data/example/test_rubyphoto_phototree/flowers/IMG_2598.jpg +0 -0
- data/example/test_rubyphoto_phototree/flowers/IMG_3068.jpg +0 -0
- data/example/test_rubyphoto_phototree/flowers/IMG_3323.jpg +0 -0
- data/example/test_rubyphoto_phototree/flowers/IMG_3348.jpg +0 -0
- data/example/{test_phototree → test_rubyphoto_phototree}/r_photo01.jpg +0 -0
- data/example/{test_phototree → test_rubyphoto_phototree}/r_photo01.jpg.xml +0 -0
- data/example/{test_phototree/catalog_data → test_rubyphoto_phototree/ralbum}/md5_to_key.yaml +0 -0
- data/example/{test_phototree/catalog_data → test_rubyphoto_phototree/ralbum}/md5_to_key.yaml.test +0 -0
- data/example/{test_phototree/catalog_data → test_rubyphoto_phototree/ralbum}/project.xml +206 -3
- data/example/{test_phototree → test_rubyphoto_phototree}/subalbum01/album.xml +0 -0
- data/example/{test_phototree → test_rubyphoto_phototree}/subalbum01/subalbum01_photo01.jpg +0 -0
- data/example/{test_phototree → test_rubyphoto_phototree}/subalbum01/subalbum01_photo01.jpg.xml +0 -0
- data/example/{test_phototree → test_rubyphoto_phototree}/subalbum01/subalbum01_photo02.jpg +0 -0
- data/example/{test_phototree → test_rubyphoto_phototree}/subalbum01/subalbum01_photo02.jpg.xml +0 -0
- data/example/{test_phototree → test_rubyphoto_phototree}/subalbum01/subalbum01_photo03.jpg +0 -0
- data/example/{test_phototree → test_rubyphoto_phototree}/subalbum01/subalbum01_photo03.jpg.xml +0 -0
- data/example/{test_phototree → test_rubyphoto_phototree}/subalbum01/subalbum01_photo04.jpg +0 -0
- data/example/{test_phototree → test_rubyphoto_phototree}/subalbum01/subalbum01_photo04.jpg.xml +0 -0
- data/example/{test_phototree → test_rubyphoto_phototree}/subalbum02/album.xml +0 -0
- data/example/{test_phototree → test_rubyphoto_phototree}/subalbum02/subalbum02_photo01.jpg +0 -0
- data/example/{test_phototree → test_rubyphoto_phototree}/subalbum02/subalbum02_photo01.jpg.xml +0 -0
- data/example/{test_phototree → test_rubyphoto_phototree}/subalbum02/subalbum02_photo02.jpg +0 -0
- data/example/{test_phototree → test_rubyphoto_phototree}/subalbum02/subalbum02_photo02.jpg.xml +0 -0
- data/example/{test_phototree → test_rubyphoto_phototree}/subalbum02/subalbum02_photo03.jpg +0 -0
- data/example/{test_phototree → test_rubyphoto_phototree}/subalbum02/subalbum02_photo03.jpg.xml +0 -0
- data/example/{test_phototree → test_rubyphoto_phototree}/subalbum02/subalbum02_photo04.jpg +0 -0
- data/example/{test_phototree → test_rubyphoto_phototree}/subalbum02/subalbum02_photo04.jpg.xml +0 -0
- data/example/{test_phototree → test_rubyphoto_phototree}/subalbum02/subalbum02_photo05.jpg +0 -0
- data/example/{test_phototree → test_rubyphoto_phototree}/subalbum02/subalbum02_photo05.jpg.xml +0 -0
- data/lib/ralbum.rb +9 -5
- data/lib/ralbum/album_tree/album.rb +74 -0
- data/lib/ralbum/album_tree/generate_album_tree_node_visitor.rb +73 -0
- data/lib/ralbum/album_tree/image_file.rb +88 -0
- data/lib/ralbum/{image_pool.rb → album_tree/image_pool.rb} +16 -4
- data/lib/ralbum/catalog.rb +7 -7
- data/lib/ralbum/cli/cli_ralbum.rb +66 -25
- data/lib/ralbum/image_strategies/copy_image_strategy.rb +16 -0
- data/lib/ralbum/image_strategies/linked_image_strategy.rb +18 -0
- data/lib/ralbum/image_strategies/scaled_image_strategy.rb +52 -0
- data/lib/ralbum/image_strategies/sepia_scaled_image_strategy.rb +50 -0
- data/lib/{ralbum-common → ralbum}/object_with_properties.rb +0 -0
- data/lib/{ralbum-common → ralbum}/object_with_validation.rb +0 -0
- data/lib/ralbum/photo_tree/jalbum_photo_tree.rb +83 -0
- data/lib/ralbum/photo_tree/photo_file.rb +149 -0
- data/lib/ralbum/photo_tree/photo_tree_item.rb +68 -0
- data/lib/ralbum/{photo_tree_node.rb → photo_tree/photo_tree_node.rb} +16 -13
- data/lib/ralbum/{photo_tree_builder.rb → photo_tree/rubyphoto_photo_tree.rb} +64 -46
- data/lib/ralbum/project.rb +48 -12
- data/lib/ralbum/skin.rb +34 -27
- data/lib/ralbum/skin_engine.rb +32 -17
- data/lib/ralbum/skin_engines/erb_skin_engine.rb +2 -5
- data/lib/ralbum/skin_engines/kwartz_skin_engine.rb +6 -9
- data/lib/ralbum/skin_manager.rb +11 -2
- data/lib/ralbum/skins/cgi/cgi_skin.rb +21 -23
- data/lib/ralbum/skins/cgi/res/model.rb +30 -32
- data/lib/ralbum/skins/gfold/inc/menu_bottom.html +53 -53
- data/lib/ralbum/skins/gfold/inc/menu_top.html +71 -71
- data/lib/ralbum/skins/gfold/inc/page_footer.html +28 -28
- data/lib/ralbum/skins/gfold/out/album_page.rb +316 -316
- data/lib/ralbum/skins/gfold/out/image_page.rb +231 -231
- data/lib/ralbum/skins/gfold/out/tree_page.rb +96 -96
- data/lib/ralbum/skins/gfold/res/prototype.js +3277 -3277
- data/lib/ralbum/skins/gfold/template/album_page.html +161 -161
- data/lib/ralbum/skins/gfold/template/album_page.plogic +127 -127
- data/lib/ralbum/skins/gfold/template/image_page.html +91 -91
- data/lib/ralbum/skins/gfold/template/image_page.plogic +70 -70
- data/lib/ralbum/skins/gfold/template/tree_page.html +79 -79
- data/lib/ralbum/skins/gfold/template/tree_page.plogic +45 -45
- data/lib/ralbum/skins/js/out/album_page.rb +2 -2
- data/lib/ralbum/skins/js/out/tree_page.rb +18 -17
- data/lib/ralbum/skins/js/template/album_page.html +2 -2
- data/lib/ralbum/skins/js/template/tree_page.html +1 -1
- data/lib/ralbum/skins/test_erb/template/album_page.rhtml +22 -0
- data/lib/ralbum/skins/test_erb/template/image_page.rhtml +44 -0
- data/lib/ralbum/tasks/compile_skins.rb +8 -0
- data/test/ralbum/cli/tc_cli_ralbum.rb +35 -0
- data/test/ralbum/image_strategies/tc_scaled_image_strategy.rb +18 -0
- data/test/ralbum/image_strategies/tc_sepia_scaled_image_strategy.rb +18 -0
- data/test/ralbum/photo_tree/tc_jalbum_photo_tree.rb +39 -0
- data/test/ralbum/photo_tree/tc_photo_file.rb +13 -0
- data/test/ralbum/{tc_01_photo_tree.rb → photo_tree/tc_photo_tree.rb} +10 -12
- data/test/ralbum/photo_tree/tc_rubyalbum_photo_tree.rb +20 -0
- data/test/ralbum/tc_album.rb +55 -0
- data/test/ralbum/tc_catalog.rb +8 -4
- data/test/ralbum/tc_image_pool.rb +37 -0
- data/test/ralbum/{tc_05_kwartz_skin_engine.rb → tc_kwartz_skin_engine.rb} +1 -1
- data/test/ralbum/{tc_04_skin_manager.rb → tc_skin_manager.rb} +8 -3
- data/test/ralbum/test_helper.rb +16 -1
- data/test_data/ralbum/test_data/is_test/dummy.txt +0 -0
- metadata +78 -81
- data/bin/ralbum-JPG2jpg.rb +0 -90
- data/bin/ralbum-compile_skins.rb +0 -18
- data/bin/ralbum-myconv.rb +0 -81
- data/bin/ralbum-readexif.rb +0 -18
- data/bin/ralbum-reorder.rb +0 -200
- data/lib/ralbum/album.rb +0 -66
- data/lib/ralbum/generate_album_tree_node_visitor.rb +0 -60
- data/lib/ralbum/image_file.rb +0 -81
- data/lib/ralbum/image_strategy.rb +0 -143
- data/lib/ralbum/photo_tree_item.rb +0 -89
- data/test/ralbum/cli/test_cli_ralbum.rb +0 -13
- data/test/ralbum/tc_02_photo_tree_builder.rb +0 -20
- data/test/ralbum/tc_03_album.rb +0 -42
- data/test/ralbum/tc_06_image_strategy.rb +0 -21
- data/test/test_ralbum.rb +0 -14
- data/test_data/ralbum/test_data/is_test/r_photo01_scaled.jpg +0 -0
- data/test_data/ralbum/test_data/is_test/r_photo01_sepia_scaled.jpg +0 -0
data/lib/ralbum/image_file.rb
DELETED
@@ -1,81 +0,0 @@
|
|
1
|
-
#gems
|
2
|
-
require 'rubygems'
|
3
|
-
require 'RMagick'
|
4
|
-
require 'image_size'
|
5
|
-
|
6
|
-
class ImageFile
|
7
|
-
|
8
|
-
attr_reader :imagePool
|
9
|
-
|
10
|
-
#
|
11
|
-
# url of image
|
12
|
-
#
|
13
|
-
# attr_reader :url
|
14
|
-
|
15
|
-
#
|
16
|
-
# url of html page displaying the image
|
17
|
-
#
|
18
|
-
attr_reader :pageurl
|
19
|
-
|
20
|
-
attr_reader :size, :width, :height
|
21
|
-
|
22
|
-
def initialize( imagePool, path, pageurl)
|
23
|
-
@imagePool = imagePool
|
24
|
-
@pageurl = pageurl
|
25
|
-
|
26
|
-
@size = File.size( path )
|
27
|
-
@size = @size / 1024
|
28
|
-
|
29
|
-
if not File.exist?(path)
|
30
|
-
raise RAlbumException.new "file '#{path}' not exist"
|
31
|
-
end
|
32
|
-
if File.directory?(path)
|
33
|
-
raise RAlbumException.new "expected '#{path}' as file but it is a directory"
|
34
|
-
end
|
35
|
-
|
36
|
-
blob = File.open(path, "rb") do |f|
|
37
|
-
f.read
|
38
|
-
end
|
39
|
-
image = Magick::ImageList.new
|
40
|
-
image.from_blob( blob )
|
41
|
-
@width = image.columns
|
42
|
-
@height = image.rows
|
43
|
-
end
|
44
|
-
|
45
|
-
def name
|
46
|
-
@imagePool.name
|
47
|
-
end
|
48
|
-
|
49
|
-
def description
|
50
|
-
@imagePool.description
|
51
|
-
end
|
52
|
-
|
53
|
-
def relroot
|
54
|
-
@imagePool.relroot
|
55
|
-
end
|
56
|
-
|
57
|
-
def relroot_with_prefix
|
58
|
-
@imagePool.relroot_with_prefix
|
59
|
-
end
|
60
|
-
|
61
|
-
def breadcrumbs
|
62
|
-
@imagePool.breadcrumbs
|
63
|
-
end
|
64
|
-
|
65
|
-
def prev_pageurl
|
66
|
-
if @imagePool.prev
|
67
|
-
@imagePool.prev.defaultImageFile.pageurl
|
68
|
-
else
|
69
|
-
nil
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
def next_pageurl
|
74
|
-
if @imagePool.next
|
75
|
-
@imagePool.next.defaultImageFile.pageurl
|
76
|
-
else
|
77
|
-
nil
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
end
|
@@ -1,143 +0,0 @@
|
|
1
|
-
# stdlib
|
2
|
-
require "fileutils"
|
3
|
-
|
4
|
-
# gems
|
5
|
-
require 'rubygems'
|
6
|
-
require 'RMagick'
|
7
|
-
|
8
|
-
#
|
9
|
-
# Strategy for build a scaled image
|
10
|
-
#
|
11
|
-
class ScaledImageStrategy
|
12
|
-
|
13
|
-
attr_reader :name, :width, :height, :quality
|
14
|
-
|
15
|
-
def initialize( name, width, height, quality )
|
16
|
-
@name = name
|
17
|
-
@width = width
|
18
|
-
@height = height
|
19
|
-
@quality = quality
|
20
|
-
end
|
21
|
-
|
22
|
-
#
|
23
|
-
# build a scaled image and store it in outpath
|
24
|
-
#
|
25
|
-
# inpath source image file
|
26
|
-
# outpath destination image file
|
27
|
-
#
|
28
|
-
def build( inpath, outpath )
|
29
|
-
# TODO: ritornare un risultato per es. 1 = skipped 2 = copiato 3 = scalata immagine
|
30
|
-
result_msg = ""
|
31
|
-
img = Magick::ImageList.new(inpath)
|
32
|
-
|
33
|
-
if @width > img.columns and @height > img.rows
|
34
|
-
result_msg = "(c) "
|
35
|
-
# FileUtils.cp( inpath, outpath )
|
36
|
-
# rimuovere i metadata
|
37
|
-
else
|
38
|
-
result_msg = "(#{@quality}%) "
|
39
|
-
img.resize_to_fit!(@width, @height)
|
40
|
-
end
|
41
|
-
img.profile!('*', nil)
|
42
|
-
|
43
|
-
img.write(outpath) {|i| i.quality = quality }
|
44
|
-
result_msg
|
45
|
-
end
|
46
|
-
|
47
|
-
def write_xml( xml_iss )
|
48
|
-
xml_is = xml_iss.add_element( "image_strategy")
|
49
|
-
xml_is.attributes["name"] = self.class.to_s
|
50
|
-
xml_par = xml_is.add_element("par")
|
51
|
-
xml_par.attributes["width"] = @width.to_s
|
52
|
-
xml_par.attributes["height"] = @height.to_s
|
53
|
-
xml_par.attributes["quality"] = @quality.to_s
|
54
|
-
end
|
55
|
-
|
56
|
-
end
|
57
|
-
|
58
|
-
#
|
59
|
-
# Strategy for build a scaled image
|
60
|
-
#
|
61
|
-
class SepiaScaledImageStrategy
|
62
|
-
|
63
|
-
attr_reader :name, :width, :height, :quality
|
64
|
-
|
65
|
-
def initialize( name, width, height, quality )
|
66
|
-
@name = name
|
67
|
-
@width = width
|
68
|
-
@height = height
|
69
|
-
@quality = quality
|
70
|
-
end
|
71
|
-
|
72
|
-
#
|
73
|
-
# build a scaled image and store it in outpath
|
74
|
-
#
|
75
|
-
# inpath source image file
|
76
|
-
# outpath destination image file
|
77
|
-
#
|
78
|
-
def build( inpath, outpath )
|
79
|
-
# TODO: ritornare un risultato per es. 1 = skipped 2 = copiato 3 = scalata immagine
|
80
|
-
result_msg = ""
|
81
|
-
img = Magick::ImageList.new(inpath)
|
82
|
-
|
83
|
-
if @width > img.columns and @height > img.rows
|
84
|
-
result_msg = "(c) "
|
85
|
-
# FileUtils.cp( inpath, outpath )
|
86
|
-
# rimuovere i metadata
|
87
|
-
else
|
88
|
-
result_msg = "(#{@quality}%) "
|
89
|
-
img.resize_to_fit!(@width, @height)
|
90
|
-
end
|
91
|
-
img = img.sepiatone
|
92
|
-
img.profile!('*', nil)
|
93
|
-
|
94
|
-
img.write(outpath) {|i| i.quality = quality }
|
95
|
-
result_msg
|
96
|
-
end
|
97
|
-
|
98
|
-
def write_xml( xml_iss )
|
99
|
-
xml_is = xml_iss.add_element( "image_strategy")
|
100
|
-
xml_is.attributes["name"] = self.class.to_s
|
101
|
-
xml_par = xml_is.add_element("par")
|
102
|
-
xml_par.attributes["width"] = @width
|
103
|
-
xml_par.attributes["height"] = @height
|
104
|
-
xml_par.attributes["quality"] = @quality
|
105
|
-
end
|
106
|
-
|
107
|
-
end
|
108
|
-
|
109
|
-
#
|
110
|
-
# Create a link from inpath to outpath
|
111
|
-
#
|
112
|
-
class LinkedImageStrategy
|
113
|
-
|
114
|
-
attr_reader :name
|
115
|
-
|
116
|
-
def initialize( name )
|
117
|
-
@name = name
|
118
|
-
end
|
119
|
-
|
120
|
-
def build( inpath, outpath )
|
121
|
-
return if File.exist?( outpath )
|
122
|
-
ralbum_verbose( 1, "link " )
|
123
|
-
File.symlink( inpath, outpath )
|
124
|
-
end
|
125
|
-
|
126
|
-
end
|
127
|
-
|
128
|
-
#
|
129
|
-
# Copy an image from inpath to outpath
|
130
|
-
#
|
131
|
-
class CopyImageStrategy
|
132
|
-
attr_reader :name
|
133
|
-
|
134
|
-
def initialize( name )
|
135
|
-
@name = name
|
136
|
-
end
|
137
|
-
|
138
|
-
def build( inpath, outpath )
|
139
|
-
FileUtils.cp( inpath, outpath )
|
140
|
-
end
|
141
|
-
|
142
|
-
end
|
143
|
-
|
@@ -1,89 +0,0 @@
|
|
1
|
-
# rubygem
|
2
|
-
require 'rubygems'
|
3
|
-
require 'RMagick'
|
4
|
-
|
5
|
-
# ralbum
|
6
|
-
require 'gf_utility/md5'
|
7
|
-
require 'tree_visitor/leaf_node'
|
8
|
-
require 'ralbum-common/object_with_properties'
|
9
|
-
require 'ralbum/options'
|
10
|
-
require 'ralbum/ralbum_exception'
|
11
|
-
|
12
|
-
#
|
13
|
-
# Un photoTreeItem contiene una "foto" (da distinguersi con un'immagine)
|
14
|
-
# e le metainformazioni sulla foto
|
15
|
-
# un photoTreeItem appartiene sempre ad un photoTreeNode
|
16
|
-
#
|
17
|
-
class PhotoTreeItem < LeafNode
|
18
|
-
include ObjectWithProperties
|
19
|
-
|
20
|
-
attr_accessor :md5
|
21
|
-
|
22
|
-
def initialize( filename, photoTreeNode )
|
23
|
-
if photoTreeNode.nil?
|
24
|
-
raise "photoTreeNode non puo' essere nil!!"
|
25
|
-
end
|
26
|
-
super( filename, photoTreeNode )
|
27
|
-
init_object_with_properties
|
28
|
-
@time = nil
|
29
|
-
end
|
30
|
-
|
31
|
-
def basename
|
32
|
-
File.basename( name )
|
33
|
-
end
|
34
|
-
|
35
|
-
def time
|
36
|
-
return @time if ! @time.nil?
|
37
|
-
@time = File.mtime( parent.path )
|
38
|
-
end
|
39
|
-
|
40
|
-
def force_read_metainfo
|
41
|
-
unless File.exist?(path)
|
42
|
-
raise RAlbumException.new "photo '#{path}' not exists"
|
43
|
-
end
|
44
|
-
blob = File.open(path, "rb") do |f|
|
45
|
-
f.read
|
46
|
-
end
|
47
|
-
@md5 = MD5.new( blob ).to_s
|
48
|
-
ralbum_verbose( 2, sprintf("%40s: %d %s \n", name, time, @md5 ) )
|
49
|
-
|
50
|
-
image = Magick::ImageList.new
|
51
|
-
image.from_blob( blob )
|
52
|
-
set_exif_property(image, "model", "Model")
|
53
|
-
set_exif_property(image, "date_and_time", "DateTimeOriginal")
|
54
|
-
set_exif_property(image, "FocalLength", "FocalLengthIn35mmFilm")
|
55
|
-
set_exif_property(image, "exposure_time", "ExposureTime")
|
56
|
-
set_exif_property(image, "white_balance", "WhiteBalance")
|
57
|
-
set_exif_property(image, "iso_speed", "ISOSpeedRatings")
|
58
|
-
|
59
|
-
@properties['width'] = image.columns
|
60
|
-
@properties['height'] = image.rows
|
61
|
-
end
|
62
|
-
|
63
|
-
def write_xml( xml_el )
|
64
|
-
xml_photo = xml_el.add_element( "photo" )
|
65
|
-
xml_photo.add_element("md5").text = md5
|
66
|
-
xml_photo.add_element("title").text = name
|
67
|
-
xml_photo.add_element("description").text = self["description"]
|
68
|
-
xml_photo.add_element("file_date").text = time
|
69
|
-
|
70
|
-
xml_exif = xml_photo.add_element("exif")
|
71
|
-
xml_exif.add_element("model").text = self["model"]
|
72
|
-
xml_exif.add_element("date_and_time").text = self["date_and_time"]
|
73
|
-
xml_exif.add_element("FocalLength").text = self["FocalLength"]
|
74
|
-
xml_exif.add_element("exposure_time").text = self["exposure_time"]
|
75
|
-
xml_exif.add_element("white_balance").text = self["white_balance"]
|
76
|
-
xml_exif.add_element("iso_speed").text = self["iso_speed"]
|
77
|
-
end
|
78
|
-
|
79
|
-
private
|
80
|
-
|
81
|
-
def set_exif_property(image, key_xml, key_exif )
|
82
|
-
a = image.get_exif_by_entry(key_exif)
|
83
|
-
if a && ( value = a[0][1] )
|
84
|
-
@properties[key_xml] = value
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
end
|
89
|
-
|
@@ -1,20 +0,0 @@
|
|
1
|
-
require File.join( File.dirname(__FILE__), "test_helper")
|
2
|
-
|
3
|
-
# ralbum
|
4
|
-
require 'ralbum/photo_tree_builder'
|
5
|
-
|
6
|
-
class TestPhotoTreeBuilder < Test::Unit::TestCase
|
7
|
-
|
8
|
-
def test_simple
|
9
|
-
builder = PhotoTreeBuilder.new
|
10
|
-
photoTree = builder.buildPhotoTreeFromDirectory( $PHOTOTREE_DIRECTORY )
|
11
|
-
assert_equal( 2, photoTree.nr_childs )
|
12
|
-
assert_equal( 10, photoTree.nr_leaves )
|
13
|
-
|
14
|
-
builder.readMetaInfoOldFormat( photoTree )
|
15
|
-
photoTreeItem = photoTree.find( "r_photo01.jpg" )
|
16
|
-
assert_equal( "descrizione di r_photo01.jpg", photoTreeItem["description"] )
|
17
|
-
# assert_equal( "100", photoTreeItem["iso_speed"])
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
data/test/ralbum/tc_03_album.rb
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
require File.join( File.dirname(__FILE__), "test_helper")
|
2
|
-
|
3
|
-
# ralbum
|
4
|
-
require 'ralbum/album'
|
5
|
-
require 'ralbum/image_pool'
|
6
|
-
require 'ralbum/image_file'
|
7
|
-
|
8
|
-
class TestAlbum < Test::Unit::TestCase
|
9
|
-
|
10
|
-
def setup
|
11
|
-
@a = Album.new( nil, "k_a", "t_a", "d_a")
|
12
|
-
@b = Album.new( @a, "k_b", "t_b", "d_b")
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_breadcrumbs
|
16
|
-
breadcrumbs = @b.breadcrumbs
|
17
|
-
assert_equal( 2, breadcrumbs.length )
|
18
|
-
assert_equal( "/index.html", breadcrumbs[0][:path])
|
19
|
-
assert_equal( "t_a", breadcrumbs[0][:title])
|
20
|
-
assert_equal( "/t_b/index.html", breadcrumbs[1][:path])
|
21
|
-
assert_equal( "t_b", breadcrumbs[1][:title])
|
22
|
-
|
23
|
-
@a.prefix_path = "skin"
|
24
|
-
breadcrumbs = @b.breadcrumbs
|
25
|
-
assert_equal( 2, breadcrumbs.length )
|
26
|
-
assert_equal( "skin/index.html", breadcrumbs[0][:path])
|
27
|
-
assert_equal( "skin/t_b/index.html", breadcrumbs[1][:path])
|
28
|
-
assert_equal( "t_b", breadcrumbs[1][:title])
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_relroot
|
32
|
-
assert_equal( 2, @b.depth )
|
33
|
-
assert_equal( "../../", @b.relroot)
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_image_pool
|
37
|
-
album = Album.new(nil, "key", "title", "description")
|
38
|
-
ip = ImagePool.new(album, "md5", "key", "title", "description" )
|
39
|
-
ip.image( "thumb", ImageFile.new(ip, File.join($PHOTOTREE_DIRECTORY, "r_photo01.jpg" ), "r_photo01.jpg" ) )
|
40
|
-
end
|
41
|
-
|
42
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require File.join( File.dirname(__FILE__), "test_helper")
|
2
|
-
|
3
|
-
# ralbum
|
4
|
-
require 'ralbum/image_strategy'
|
5
|
-
|
6
|
-
class TestImageStrategies < Test::Unit::TestCase
|
7
|
-
|
8
|
-
def test_scaled_image_strategy
|
9
|
-
is = ScaledImageStrategy.new("test", 200, 200, 75)
|
10
|
-
img_inpath = File.join( $PHOTOTREE_DIRECTORY, "r_photo01.jpg" )
|
11
|
-
img_outpath = File.join( $TEST_DATA, "is_test", "r_photo01_scaled.jpg")
|
12
|
-
is.build( img_inpath, img_outpath )
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_sepia_scaled_image_strategy
|
16
|
-
is = SepiaScaledImageStrategy.new("test", 400, 400, 75)
|
17
|
-
img_inpath = File.join( $PHOTOTREE_DIRECTORY, "r_photo01.jpg" )
|
18
|
-
img_outpath = File.join( $TEST_DATA, "is_test", "r_photo01_sepia_scaled.jpg")
|
19
|
-
is.build( img_inpath, img_outpath )
|
20
|
-
end
|
21
|
-
end
|
data/test/test_ralbum.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
# stdlib
|
2
|
-
require "test/unit"
|
3
|
-
|
4
|
-
# ralbum
|
5
|
-
$RALBUM_HOME = File.expand_path( File.join( File.dirname( __FILE__), "..", ".." ) )
|
6
|
-
$:.unshift( File.join($RALBUM_HOME, "lib" ) )
|
7
|
-
$:.unshift( File.join($RALBUM_HOME, "test" ) )
|
8
|
-
|
9
|
-
require 'ralbum/tc_01_photo_tree'
|
10
|
-
require 'ralbum/tc_02_photo_tree_builder'
|
11
|
-
require 'ralbum/tc_03_album'
|
12
|
-
require 'ralbum/tc_04_skin_manager'
|
13
|
-
require 'ralbum/tc_05_kwartz_skin_engine'
|
14
|
-
require 'ralbum/tc_06_image_strategy'
|
Binary file
|
Binary file
|