zena 0.16.3 → 0.16.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/History.txt +11 -0
- data/app/controllers/nodes_controller.rb +1 -1
- data/app/controllers/versions_controller.rb +1 -1
- data/app/controllers/virtual_classes_controller.rb +29 -2
- data/app/models/cached_page.rb +3 -3
- data/app/models/document.rb +1 -20
- data/app/models/iformat.rb +4 -4
- data/app/models/image.rb +1 -1
- data/app/models/image_content.rb +5 -5
- data/app/models/node.rb +25 -0
- data/app/models/text_document_version.rb +11 -3
- data/app/models/virtual_class.rb +50 -0
- data/app/views/{nodes → sites}/404.html +0 -0
- data/app/views/templates/edit_tabs/_image.rhtml +1 -1
- data/app/views/versions/_list.rhtml +3 -1
- data/app/views/virtual_classes/_li.erb +2 -2
- data/app/views/virtual_classes/index.erb +9 -1
- data/bricks/tags/patch/node.rb +1 -1
- data/config/bricks.yml +1 -1
- data/config/gems.yml +4 -2
- data/db/migrate/047_change_default_link_id_to_zero.rb +1 -1
- data/db/migrate/20090825201159_insert_zero_link.rb +1 -1
- data/lib/bricks.rb +2 -2
- data/lib/bricks/requirements_validation.rb +13 -8
- data/lib/gettext_strings.rb +1 -0
- data/lib/tasks/zena.rake +15 -6
- data/lib/zena.rb +9 -3
- data/lib/{base_additions.rb → zena/base_additions.rb} +0 -0
- data/lib/{core_ext → zena/core_ext}/date_time.rb +0 -0
- data/lib/{core_ext → zena/core_ext}/dir.rb +0 -0
- data/lib/zena/core_ext/file_utils.rb +13 -0
- data/lib/{core_ext → zena/core_ext}/fixnum.rb +0 -0
- data/lib/{core_ext → zena/core_ext}/string.rb +0 -0
- data/lib/zena/deploy.rb +1 -1
- data/lib/zena/deploy/start.html +1 -1
- data/lib/zena/deploy/template.rb +5 -1
- data/lib/{fix_rails_layouts.rb → zena/fix_rails_layouts.rb} +0 -0
- data/lib/zena/info.rb +2 -2
- data/lib/zena/routes.rb +1 -1
- data/lib/zena/use/fixtures.rb +1 -1
- data/lib/zena/use/html_tags.rb +3 -3
- data/lib/zena/use/image_builder.rb +329 -0
- data/lib/zena/use/query_comment.rb +96 -0
- data/lib/zena/use/query_node.rb +408 -0
- data/lib/zena/use/query_node_finders.rb +91 -0
- data/lib/zena/use/rendering.rb +2 -2
- data/lib/{webdav_adapter.rb → zena/webdav_adapter.rb} +0 -0
- data/locale/de/LC_MESSAGES/zena.mo +0 -0
- data/locale/de/zena.po +1456 -0
- data/locale/en/LC_MESSAGES/zena.mo +0 -0
- data/locale/en/zena.po +626 -1197
- data/locale/fr/LC_MESSAGES/zena.mo +0 -0
- data/locale/fr/zena.po +895 -1221
- data/locale/zena.pot +527 -1027
- data/public/calendar/lang/calendar-de-utf8.js +128 -0
- data/public/calendar/menuarrow.gif +0 -0
- data/public/stylesheets/admin.css +2 -1
- data/test/custom_queries/complex.host.yml +1 -1
- data/test/fixtures/files/vclasses.yml +12 -0
- data/test/functional/virtual_classes_controller_test.rb +9 -0
- data/test/helpers/{node_query → query_node}/basic.yml +0 -0
- data/test/helpers/{node_query → query_node}/comments.yml +0 -0
- data/test/helpers/{node_query → query_node}/complex.yml +0 -0
- data/test/helpers/{node_query → query_node}/filters.yml +0 -0
- data/test/helpers/{node_query → query_node}/relations.yml +0 -0
- data/test/helpers/{node_query_test.rb → query_node_test.rb} +1 -2
- data/test/integration/navigation_test.rb +2 -0
- data/test/test_helper.rb +1 -1
- data/test/test_zena.rb +1 -1
- data/test/unit/core_ext_test.rb +3 -3
- data/test/unit/iformat_test.rb +3 -3
- data/test/unit/image_builder_test.rb +34 -34
- data/test/unit/node_test.rb +15 -1
- data/test/unit/virtual_class_test.rb +106 -0
- data/test/unit/zena/use/upload_test.rb +3 -3
- data/vendor/plugins/gettext_i18n_rails/tasks/gettext_rails_i18n.rake +3 -3
- data/zena.gemspec +36 -29
- data/zena_console.rb +33 -0
- metadata +30 -23
- data/lib/comment_query.rb +0 -92
- data/lib/image_builder.rb +0 -325
- data/lib/zena/use/node_query_finders.rb +0 -494
- data/vendor/bricks/20070122-172926.txt +0 -282
@@ -0,0 +1,128 @@
|
|
1
|
+
// ** I18N
|
2
|
+
|
3
|
+
// Calendar DE language
|
4
|
+
// Author: Jack (tR), <jack@jtr.de>
|
5
|
+
// Encoding: any
|
6
|
+
// Distributed under the same terms as the calendar itself.
|
7
|
+
|
8
|
+
// For translators: please use UTF-8 if possible. We strongly believe that
|
9
|
+
// Unicode is the answer to a real internationalized world. Also please
|
10
|
+
// include your contact information in the header, as can be seen above.
|
11
|
+
|
12
|
+
// full day names
|
13
|
+
Calendar._DN = new Array
|
14
|
+
("Sonntag",
|
15
|
+
"Montag",
|
16
|
+
"Dienstag",
|
17
|
+
"Mittwoch",
|
18
|
+
"Donnerstag",
|
19
|
+
"Freitag",
|
20
|
+
"Samstag",
|
21
|
+
"Sonntag");
|
22
|
+
|
23
|
+
// First day of the week. "0" means display Sunday first, "1" means display
|
24
|
+
// Monday first, etc.
|
25
|
+
Calendar._FD = "1";
|
26
|
+
|
27
|
+
// Please note that the following array of short day names (and the same goes
|
28
|
+
// for short month names, _SMN) isn't absolutely necessary. We give it here
|
29
|
+
// for exemplification on how one can customize the short day names, but if
|
30
|
+
// they are simply the first N letters of the full name you can simply say:
|
31
|
+
//
|
32
|
+
// Calendar._SDN_len = N; // short day name length
|
33
|
+
// Calendar._SMN_len = N; // short month name length
|
34
|
+
//
|
35
|
+
// If N = 3 then this is not needed either since we assume a value of 3 if not
|
36
|
+
// present, to be compatible with translation files that were written before
|
37
|
+
// this feature.
|
38
|
+
|
39
|
+
// short day names
|
40
|
+
Calendar._SDN = new Array
|
41
|
+
("So",
|
42
|
+
"Mo",
|
43
|
+
"Di",
|
44
|
+
"Mi",
|
45
|
+
"Do",
|
46
|
+
"Fr",
|
47
|
+
"Sa",
|
48
|
+
"So");
|
49
|
+
|
50
|
+
// full month names
|
51
|
+
Calendar._MN = new Array
|
52
|
+
("Januar",
|
53
|
+
"Februar",
|
54
|
+
"M\u00e4rz",
|
55
|
+
"April",
|
56
|
+
"Mai",
|
57
|
+
"Juni",
|
58
|
+
"Juli",
|
59
|
+
"August",
|
60
|
+
"September",
|
61
|
+
"Oktober",
|
62
|
+
"November",
|
63
|
+
"Dezember");
|
64
|
+
|
65
|
+
// short month names
|
66
|
+
Calendar._SMN = new Array
|
67
|
+
("Jan",
|
68
|
+
"Feb",
|
69
|
+
"M\u00e4r",
|
70
|
+
"Apr",
|
71
|
+
"May",
|
72
|
+
"Jun",
|
73
|
+
"Jul",
|
74
|
+
"Aug",
|
75
|
+
"Sep",
|
76
|
+
"Okt",
|
77
|
+
"Nov",
|
78
|
+
"Dez");
|
79
|
+
|
80
|
+
// tooltips
|
81
|
+
Calendar._TT = {};
|
82
|
+
Calendar._TT["INFO"] = "\u00DCber dieses Kalendarmodul";
|
83
|
+
|
84
|
+
Calendar._TT["ABOUT"] =
|
85
|
+
"DHTML Date/Time Selector\n" +
|
86
|
+
"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this ;-)
|
87
|
+
"For latest version visit: http://www.dynarch.com/projects/calendar/\n" +
|
88
|
+
"Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." +
|
89
|
+
"\n\n" +
|
90
|
+
"Datum ausw\u00e4hlen:\n" +
|
91
|
+
"- Benutzen Sie die \xab, \xbb Buttons um das Jahr zu w\u00e4hlen\n" +
|
92
|
+
"- Benutzen Sie die " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " Buttons um den Monat zu w\u00e4hlen\n" +
|
93
|
+
"- F\u00fcr eine Schnellauswahl halten Sie die Maustaste \u00fcber diesen Buttons fest.";
|
94
|
+
Calendar._TT["ABOUT_TIME"] = "\n\n" +
|
95
|
+
"Zeit ausw\u00e4hlen:\n" +
|
96
|
+
"- Klicken Sie auf die Teile der Uhrzeit, um diese zu erh\u00F6hen\n" +
|
97
|
+
"- oder klicken Sie mit festgehaltener Shift-Taste um diese zu verringern\n" +
|
98
|
+
"- oder klicken und festhalten f\u00fcr Schnellauswahl.";
|
99
|
+
|
100
|
+
Calendar._TT["TOGGLE"] = "Ersten Tag der Woche w\u00e4hlen";
|
101
|
+
Calendar._TT["PREV_YEAR"] = "Voriges Jahr (Festhalten f\u00fcr Schnellauswahl)";
|
102
|
+
Calendar._TT["PREV_MONTH"] = "Voriger Monat (Festhalten f\u00fcr Schnellauswahl)";
|
103
|
+
Calendar._TT["GO_TODAY"] = "Heute ausw\u00e4hlen";
|
104
|
+
Calendar._TT["NEXT_MONTH"] = "N\u00e4chst. Monat (Festhalten f\u00fcr Schnellauswahl)";
|
105
|
+
Calendar._TT["NEXT_YEAR"] = "N\u00e4chst. Jahr (Festhalten f\u00fcr Schnellauswahl)";
|
106
|
+
Calendar._TT["SEL_DATE"] = "Datum ausw\u00e4hlen";
|
107
|
+
Calendar._TT["DRAG_TO_MOVE"] = "Zum Bewegen festhalten";
|
108
|
+
Calendar._TT["PART_TODAY"] = " (Heute)";
|
109
|
+
|
110
|
+
// the following is to inform that "%s" is to be the first day of week
|
111
|
+
// %s will be replaced with the day name.
|
112
|
+
Calendar._TT["DAY_FIRST"] = "Woche beginnt mit %s ";
|
113
|
+
|
114
|
+
// This may be locale-dependent. It specifies the week-end days, as an array
|
115
|
+
// of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1
|
116
|
+
// means Monday, etc.
|
117
|
+
Calendar._TT["WEEKEND"] = "0,6";
|
118
|
+
|
119
|
+
Calendar._TT["CLOSE"] = "Schlie\u00dfen";
|
120
|
+
Calendar._TT["TODAY"] = "Heute";
|
121
|
+
Calendar._TT["TIME_PART"] = "(Shift-)Klick oder Festhalten und Ziehen um den Wert zu \u00e4ndern";
|
122
|
+
|
123
|
+
// date formats
|
124
|
+
Calendar._TT["DEF_DATE_FORMAT"] = "%d.%m.%Y";
|
125
|
+
Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e";
|
126
|
+
|
127
|
+
Calendar._TT["WK"] = "KW";
|
128
|
+
Calendar._TT["TIME"] = "Zeit:";
|
Binary file
|
@@ -17,6 +17,8 @@
|
|
17
17
|
|
18
18
|
table.admin, table.admin table { border-collapse:separate; border-width:0; margin:auto; border-color:#666; border-style:solid; }
|
19
19
|
table.admin { width:500px; }
|
20
|
+
.admin_group { display:table; margin:1em auto; width:500px; border:1px solid grey; padding:5px; background:#eee;}
|
21
|
+
.admin_group .btn_validate { float:right;}
|
20
22
|
table.admin table { width:90%; }
|
21
23
|
table.admin table td { text-align:left; }
|
22
24
|
table.admin td:first-child { border-left: 1px solid #666; }
|
@@ -38,7 +40,6 @@ table.admin td:first-child { border-left: 1px solid #666; }
|
|
38
40
|
.admin .adm_add table { border: 0; margin:10px;}
|
39
41
|
.admin .adm_add table td { border: 0; font-size:inherit; padding: 2px; }
|
40
42
|
.admin .btn_validate { float:right; margin-right:30px; }
|
41
|
-
.btn_validate input { background:#C8D8C7; border:1px outset black;}
|
42
43
|
.admin .label {width:150px; line-height:1.9em;}
|
43
44
|
.admin th { color:#450009; }
|
44
45
|
.admin .source, .admin .source_role { background:#DBBFBF;}
|
@@ -59,4 +59,13 @@ class VirtualClassesControllerTest < Zena::Controller::TestCase
|
|
59
59
|
end
|
60
60
|
assert_redirected_to virtual_classes_path
|
61
61
|
end
|
62
|
+
|
63
|
+
context 'importing virtual class definitions' do
|
64
|
+
should 'create virtual_classes' do
|
65
|
+
assert_difference('VirtualClass.count', 3) do
|
66
|
+
post :import, :attachment => uploaded_fixture('vclasses.yml', 'text/yaml')
|
67
|
+
end
|
68
|
+
list = assigns(:virtual_classes)
|
69
|
+
end
|
70
|
+
end
|
62
71
|
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,9 +1,8 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
require 'yamltest'
|
3
3
|
|
4
|
-
class
|
4
|
+
class QueryNodeTest < Zena::Unit::TestCase
|
5
5
|
yamltest
|
6
|
-
|
7
6
|
def yt_do_test(file, test)
|
8
7
|
context = Hash[*(yt_get('context', file, test).map{|k,v| [k.to_sym, v]}.flatten)]
|
9
8
|
|
@@ -189,6 +189,8 @@ class NavigationTest < ActionController::IntegrationTest
|
|
189
189
|
assert_redirected_to 'http://test.host/en/1'
|
190
190
|
follow_redirect!
|
191
191
|
assert_response :missing
|
192
|
+
assert Thread.current[:visitor]
|
193
|
+
assert_match %r{Node-\+notFound}, @response.rendered[:template].to_s
|
192
194
|
end
|
193
195
|
|
194
196
|
def test_change_session_lang_on_login
|
data/test/test_helper.rb
CHANGED
@@ -23,7 +23,7 @@ end
|
|
23
23
|
class SubPagerDummy < PagerDummy
|
24
24
|
end
|
25
25
|
|
26
|
-
|
26
|
+
Zena::Use::QueryNode.load_custom_queries File.join(Zena::ROOT, 'test', 'custom_queries')
|
27
27
|
|
28
28
|
class ActiveSupport::TestCase
|
29
29
|
# Transactional fixtures accelerate your tests by wrapping each test method
|
data/test/test_zena.rb
CHANGED
data/test/unit/core_ext_test.rb
CHANGED
@@ -2,9 +2,9 @@ require 'rubygems'
|
|
2
2
|
require 'tzinfo'
|
3
3
|
require 'test/unit'
|
4
4
|
require 'fileutils'
|
5
|
-
require File.join(File.dirname(__FILE__), '../../lib/core_ext/string')
|
6
|
-
require File.join(File.dirname(__FILE__), '../../lib/core_ext/fixnum')
|
7
|
-
require File.join(File.dirname(__FILE__), '../../lib/core_ext/dir')
|
5
|
+
require File.join(File.dirname(__FILE__), '../../lib/zena/core_ext/string')
|
6
|
+
require File.join(File.dirname(__FILE__), '../../lib/zena/core_ext/fixnum')
|
7
|
+
require File.join(File.dirname(__FILE__), '../../lib/zena/core_ext/dir')
|
8
8
|
|
9
9
|
class StringExtTest < Test::Unit::TestCase
|
10
10
|
def test_abs_rel_path
|
data/test/unit/iformat_test.rb
CHANGED
@@ -15,7 +15,7 @@ class IformatTest < Zena::Unit::TestCase
|
|
15
15
|
def test_redefined_format
|
16
16
|
login(:lion)
|
17
17
|
fmt = Iformat['med']
|
18
|
-
assert_not_equal ImageBuilder::DEFAULT_FORMATS['med'], fmt
|
18
|
+
assert_not_equal Zena::Use::ImageBuilder::DEFAULT_FORMATS['med'], fmt
|
19
19
|
assert_equal ({:name => 'med', :width=>300, :height=>200, :gravity=>Magick::CenterGravity, :size=>:limit, :hash_id => 389519063846, :popup => {:show=> %w{navigation v_title v_summary}, :name=>'std', :options=>{'v_title'=>'link'}}}), fmt
|
20
20
|
end
|
21
21
|
|
@@ -35,7 +35,7 @@ class IformatTest < Zena::Unit::TestCase
|
|
35
35
|
|
36
36
|
def test_other_site
|
37
37
|
login(:whale)
|
38
|
-
assert_equal ImageBuilder::DEFAULT_FORMATS['med'], Iformat['med']
|
38
|
+
assert_equal Zena::Use::ImageBuilder::DEFAULT_FORMATS['med'], Iformat['med']
|
39
39
|
end
|
40
40
|
|
41
41
|
def test_defined_format
|
@@ -182,7 +182,7 @@ class IformatTest < Zena::Unit::TestCase
|
|
182
182
|
def test_new_from_default
|
183
183
|
login(:lion)
|
184
184
|
imf = Iformat.new_from_default('pv')
|
185
|
-
assert_equal ImageBuilder::DEFAULT_FORMATS['pv'], imf.as_hash
|
185
|
+
assert_equal Zena::Use::ImageBuilder::DEFAULT_FORMATS['pv'], imf.as_hash
|
186
186
|
assert_equal 70, imf[:height]
|
187
187
|
assert_equal 70, imf[:width]
|
188
188
|
assert_equal 2, imf[:size]
|
@@ -1,12 +1,12 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
-
class ImageBuilderTest < Zena::Unit::TestCase
|
3
|
+
class Zena::Use::ImageBuilderTest < Zena::Unit::TestCase
|
4
4
|
|
5
5
|
# Dummy tests
|
6
|
-
if ImageBuilder.dummy?
|
6
|
+
if Zena::Use::ImageBuilder.dummy?
|
7
7
|
def test_dummy
|
8
8
|
img = nil
|
9
|
-
assert_nothing_raised { img = ImageBuilder.new(:path=>uploaded_jpg('bird.jpg').path, :width=>100, :height=>30) }
|
9
|
+
assert_nothing_raised { img = Zena::Use::ImageBuilder.new(:path=>uploaded_jpg('bird.jpg').path, :width=>100, :height=>30) }
|
10
10
|
assert img.dummy?, 'Image is a dummy'
|
11
11
|
assert_nil img.read
|
12
12
|
assert_equal 100, img.width
|
@@ -14,20 +14,20 @@ class ImageBuilderTest < Zena::Unit::TestCase
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def test_render_img
|
17
|
-
img = ImageBuilder.new(:path=>uploaded_jpg('bird.jpg').path, :width=>100, :height=>30)
|
17
|
+
img = Zena::Use::ImageBuilder.new(:path=>uploaded_jpg('bird.jpg').path, :width=>100, :height=>30)
|
18
18
|
assert_raise(IOError) { img.render_img }
|
19
19
|
end
|
20
20
|
|
21
21
|
def test_rows_0
|
22
|
-
img = ImageBuilder.new(:path=>uploaded_jpg('bird.jpg').path)
|
22
|
+
img = Zena::Use::ImageBuilder.new(:path=>uploaded_jpg('bird.jpg').path)
|
23
23
|
assert_nil img.width
|
24
24
|
assert_nil img.height
|
25
25
|
end
|
26
26
|
else
|
27
27
|
def test_dummy
|
28
28
|
img = nil
|
29
|
-
assert_nothing_raised { img = ImageBuilder.new(:path=>uploaded_jpg('bird.jpg').path, :width=>100, :height=>30) }
|
30
|
-
assert ! ImageBuilder.dummy?, 'Image is not a dummy'
|
29
|
+
assert_nothing_raised { img = Zena::Use::ImageBuilder.new(:path=>uploaded_jpg('bird.jpg').path, :width=>100, :height=>30) }
|
30
|
+
assert ! Zena::Use::ImageBuilder.dummy?, 'Image is not a dummy'
|
31
31
|
assert_nothing_raised { img.render_img }
|
32
32
|
assert img.read
|
33
33
|
assert_equal 100, img.width
|
@@ -35,20 +35,20 @@ class ImageBuilderTest < Zena::Unit::TestCase
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def test_render_without_img
|
38
|
-
img = ImageBuilder.new(:width=>100, :height=>30)
|
39
|
-
assert ! ImageBuilder.dummy?, 'Class is not a dummy'
|
38
|
+
img = Zena::Use::ImageBuilder.new(:width=>100, :height=>30)
|
39
|
+
assert ! Zena::Use::ImageBuilder.dummy?, 'Class is not a dummy'
|
40
40
|
assert img.dummy?, 'Image is a dummy'
|
41
41
|
assert_raise(IOError) { img.render_img }
|
42
42
|
assert_nil img.read
|
43
43
|
end
|
44
44
|
|
45
45
|
def test_render_img
|
46
|
-
img = ImageBuilder.new(:path=>uploaded_jpg('bird.jpg').path, :width=>100, :height=>30)
|
46
|
+
img = Zena::Use::ImageBuilder.new(:path=>uploaded_jpg('bird.jpg').path, :width=>100, :height=>30)
|
47
47
|
assert_nothing_raised { img.render_img }
|
48
48
|
end
|
49
49
|
|
50
50
|
def test_write_sepia
|
51
|
-
img = ImageBuilder.new(:path=>uploaded_jpg('bird.jpg').path)
|
51
|
+
img = Zena::Use::ImageBuilder.new(:path=>uploaded_jpg('bird.jpg').path)
|
52
52
|
img.transform!(:size=>:limit, :width=>280, :ratio=>2/3.0, :post=>Proc.new {|img| img.sepiatone(Magick::MaxRGB * 0.8)})
|
53
53
|
assert !File.exist?("#{SITES_ROOT}/test.host/sepia.jpg"), "File does not exist"
|
54
54
|
assert_nothing_raised { img.write("#{SITES_ROOT}/test.host/sepia.jpg")}
|
@@ -58,14 +58,14 @@ class ImageBuilderTest < Zena::Unit::TestCase
|
|
58
58
|
|
59
59
|
def test_png
|
60
60
|
path = "#{Zena::ROOT}/public/images/ext/pdf.png"
|
61
|
-
img = ImageBuilder.new(:path=>path, :width=>30, :height=>30)
|
61
|
+
img = Zena::Use::ImageBuilder.new(:path=>path, :width=>30, :height=>30)
|
62
62
|
img.transform!(:size=>:force, :width=>70, :height=>79)
|
63
63
|
assert_nothing_raised { data = img.read }
|
64
64
|
end
|
65
65
|
|
66
66
|
def test_format
|
67
67
|
path = "#{Zena::ROOT}/public/images/ext/pdf.png"
|
68
|
-
img = ImageBuilder.new(:path=>path, :width=>30, :height=>30)
|
68
|
+
img = Zena::Use::ImageBuilder.new(:path=>path, :width=>30, :height=>30)
|
69
69
|
img.format = 'jpg'
|
70
70
|
new_img = img.render_img
|
71
71
|
assert_kind_of Magick::ImageList, new_img
|
@@ -74,7 +74,7 @@ class ImageBuilderTest < Zena::Unit::TestCase
|
|
74
74
|
|
75
75
|
def test_limit_size
|
76
76
|
path = "#{Zena::ROOT}/test/fixtures/files/bird.jpg"
|
77
|
-
img = ImageBuilder.new(:path=>path, :width=>30, :height=>30)
|
77
|
+
img = Zena::Use::ImageBuilder.new(:path=>path, :width=>30, :height=>30)
|
78
78
|
assert_equal 56243, File.stat(path).size
|
79
79
|
img.max_filesize = 40000
|
80
80
|
new_img = img.render_img
|
@@ -86,90 +86,90 @@ class ImageBuilderTest < Zena::Unit::TestCase
|
|
86
86
|
end
|
87
87
|
|
88
88
|
def test_image_content_type
|
89
|
-
assert ImageBuilder.image_content_type?('image/jpeg'), "jpeg is an image"
|
90
|
-
assert ImageBuilder.image_content_type?('image/png'), "png is an image"
|
91
|
-
assert !ImageBuilder.image_content_type?('application/pdf'), "pdf is not an image"
|
89
|
+
assert Zena::Use::ImageBuilder.image_content_type?('image/jpeg'), "jpeg is an image"
|
90
|
+
assert Zena::Use::ImageBuilder.image_content_type?('image/png'), "png is an image"
|
91
|
+
assert ! Zena::Use::ImageBuilder.image_content_type?('application/pdf'), "pdf is not an image"
|
92
92
|
end
|
93
93
|
|
94
94
|
def test_resize
|
95
|
-
img = ImageBuilder.new(:width=>100, :height=>30)
|
95
|
+
img = Zena::Use::ImageBuilder.new(:width=>100, :height=>30)
|
96
96
|
img.resize!(0.5)
|
97
97
|
assert_equal 50, img.width
|
98
98
|
assert_equal 15, img.height
|
99
99
|
end
|
100
100
|
|
101
101
|
def test_crop_min
|
102
|
-
img = ImageBuilder.new(:width=>100, :height=>30)
|
102
|
+
img = Zena::Use::ImageBuilder.new(:width=>100, :height=>30)
|
103
103
|
img.crop_min!(80, 70)
|
104
104
|
assert_equal 80, img.width
|
105
105
|
assert_equal 30, img.height
|
106
106
|
end
|
107
107
|
|
108
108
|
def test_crop
|
109
|
-
img = ImageBuilder.new(:width=>100, :height=>30)
|
109
|
+
img = Zena::Use::ImageBuilder.new(:width=>100, :height=>30)
|
110
110
|
img.crop!(5, 10, 80, 70)
|
111
111
|
assert_equal 80, img.width
|
112
112
|
assert_equal 20, img.height
|
113
113
|
end
|
114
114
|
|
115
115
|
def test_set_background
|
116
|
-
img = ImageBuilder.new(:width=>100, :height=>30)
|
116
|
+
img = Zena::Use::ImageBuilder.new(:width=>100, :height=>30)
|
117
117
|
img.set_background!(Magick::MaxRGB,120,15)
|
118
118
|
assert_equal 120, img.width
|
119
119
|
assert_equal 30, img.height
|
120
120
|
end
|
121
121
|
|
122
122
|
def test_transform_limit
|
123
|
-
img = ImageBuilder.new(:width=>100, :height=>30)
|
123
|
+
img = Zena::Use::ImageBuilder.new(:width=>100, :height=>30)
|
124
124
|
img.transform!(:size=>:limit, :width=>80, :height=>60)
|
125
125
|
assert_equal 80, img.width
|
126
126
|
assert_equal 24, img.height
|
127
127
|
end
|
128
128
|
|
129
129
|
def test_transform_force
|
130
|
-
img = ImageBuilder.new(:width=>100, :height=>30)
|
130
|
+
img = Zena::Use::ImageBuilder.new(:width=>100, :height=>30)
|
131
131
|
img.transform!(:size=>:force, :width=>80, :height=>60)
|
132
132
|
assert_equal 80, img.width
|
133
133
|
assert_equal 60, img.height
|
134
134
|
end
|
135
135
|
|
136
136
|
def test_transform_force_no_crop
|
137
|
-
img = ImageBuilder.new(:width=>100, :height=>30)
|
137
|
+
img = Zena::Use::ImageBuilder.new(:width=>100, :height=>30)
|
138
138
|
img.transform!(:size=>:force_no_crop, :width=>80, :height=>60)
|
139
139
|
assert_equal 80, img.width
|
140
140
|
assert_equal 60, img.height
|
141
141
|
end
|
142
142
|
|
143
143
|
def test_transform_ratio
|
144
|
-
img = ImageBuilder.new(:width=>100, :height=>30)
|
144
|
+
img = Zena::Use::ImageBuilder.new(:width=>100, :height=>30)
|
145
145
|
img.transform!(:size=>:force, :height=>30, :ratio=>3.0/4)
|
146
146
|
assert_equal 30, img.height
|
147
147
|
assert_equal 40, img.width
|
148
148
|
end
|
149
149
|
|
150
150
|
def test_transform_ratio_width
|
151
|
-
img = ImageBuilder.new(:width=>30, :height=>100)
|
151
|
+
img = Zena::Use::ImageBuilder.new(:width=>30, :height=>100)
|
152
152
|
img.transform!(:size=>:force, :width=>40, :ratio=>3.0/4.0)
|
153
153
|
assert_equal 30, img.height
|
154
154
|
assert_equal 40, img.width
|
155
155
|
end
|
156
156
|
|
157
157
|
def test_transform_scale
|
158
|
-
img = ImageBuilder.new(:width=>30, :height=>100)
|
158
|
+
img = Zena::Use::ImageBuilder.new(:width=>30, :height=>100)
|
159
159
|
img.transform!(:size=>:force, :scale=>0.5)
|
160
160
|
assert_equal 15, img.width
|
161
161
|
assert_equal 50, img.height
|
162
162
|
end
|
163
163
|
|
164
164
|
def test_transform_scale_up
|
165
|
-
img = ImageBuilder.new(:width=>30, :height=>100)
|
165
|
+
img = Zena::Use::ImageBuilder.new(:width=>30, :height=>100)
|
166
166
|
img.transform!(:size=>:force, :scale=>2.0)
|
167
167
|
assert_equal 60, img.width
|
168
168
|
assert_equal 200, img.height
|
169
169
|
end
|
170
170
|
|
171
171
|
def test_transform_scale_up_no_size
|
172
|
-
img = ImageBuilder.new(:width=>30, :height=>100)
|
172
|
+
img = Zena::Use::ImageBuilder.new(:width=>30, :height=>100)
|
173
173
|
img.transform!(:scale=>2.0)
|
174
174
|
assert_equal 60, img.width
|
175
175
|
assert_equal 200, img.height
|
@@ -182,15 +182,15 @@ class ImageBuilderTest < Zena::Unit::TestCase
|
|
182
182
|
end
|
183
183
|
|
184
184
|
def test_transform_limit_with_ratio
|
185
|
-
img = ImageBuilder.new(:width=>30, :height=>100)
|
185
|
+
img = Zena::Use::ImageBuilder.new(:width=>30, :height=>100)
|
186
186
|
img.transform!(:size=>:limit, :height=>50, :ratio=>2.0/1.0)
|
187
187
|
assert_equal 15, img.width
|
188
188
|
assert_equal 50, img.height
|
189
|
-
img = ImageBuilder.new(:width=>30, :height=>100)
|
189
|
+
img = Zena::Use::ImageBuilder.new(:width=>30, :height=>100)
|
190
190
|
img.transform!(:size=>:limit, :height=>200, :ratio=>4.0/1.0)
|
191
191
|
assert_equal 30, img.width
|
192
192
|
assert_equal 100, img.height
|
193
|
-
img = ImageBuilder.new(:width=>30, :height=>100)
|
193
|
+
img = Zena::Use::ImageBuilder.new(:width=>30, :height=>100)
|
194
194
|
img.transform!(:height=>50, :ratio=>1.0/3.0)
|
195
195
|
assert_equal 15, img.width
|
196
196
|
assert_equal 50, img.height
|
@@ -198,7 +198,7 @@ class ImageBuilderTest < Zena::Unit::TestCase
|
|
198
198
|
|
199
199
|
def test_exif
|
200
200
|
path = "#{Zena::ROOT}/test/fixtures/files/exif_sample.jpg"
|
201
|
-
img = ImageBuilder.new(:path=>path)
|
201
|
+
img = Zena::Use::ImageBuilder.new(:path=>path)
|
202
202
|
exif = img.exif
|
203
203
|
|
204
204
|
assert exif['DateTime']
|
@@ -207,7 +207,7 @@ class ImageBuilderTest < Zena::Unit::TestCase
|
|
207
207
|
|
208
208
|
def test_parse_dates_in_exif
|
209
209
|
path = "#{Zena::ROOT}/test/fixtures/files/exif_sample.jpg"
|
210
|
-
img = ImageBuilder.new(:path=>path)
|
210
|
+
img = Zena::Use::ImageBuilder.new(:path=>path)
|
211
211
|
assert_equal "1998:01:01 00:00:00", img.exif['DateTime']
|
212
212
|
assert_equal Time.parse("1998-01-01 00:00:00"), img.exif.date_time
|
213
213
|
end
|