iiif-presentation 1.4.2 → 1.5.0
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.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +8 -1
- data/.standard.yml +1 -0
- data/Gemfile +5 -5
- data/README.md +1 -1
- data/Rakefile +4 -2
- data/VERSION +1 -1
- data/bin/standardrb +16 -0
- data/iiif-presentation.gemspec +23 -23
- data/lib/iiif/hash_behaviours.rb +29 -33
- data/lib/iiif/ordered_hash.rb +33 -33
- data/lib/iiif/presentation/abstract_resource.rb +17 -22
- data/lib/iiif/presentation/annotation.rb +9 -11
- data/lib/iiif/presentation/annotation_list.rb +8 -10
- data/lib/iiif/presentation/canvas.rb +11 -13
- data/lib/iiif/presentation/collection.rb +7 -9
- data/lib/iiif/presentation/image_resource.rb +33 -35
- data/lib/iiif/presentation/layer.rb +8 -10
- data/lib/iiif/presentation/manifest.rb +9 -12
- data/lib/iiif/presentation/range.rb +8 -10
- data/lib/iiif/presentation/resource.rb +5 -7
- data/lib/iiif/presentation/sequence.rb +8 -11
- data/lib/iiif/presentation/service.rb +1 -2
- data/lib/iiif/presentation.rb +7 -7
- data/lib/iiif/service.rb +121 -102
- data/lib/iiif/v3/abstract_resource.rb +127 -130
- data/lib/iiif/v3/presentation/annotation.rb +20 -21
- data/lib/iiif/v3/presentation/annotation_collection.rb +7 -9
- data/lib/iiif/v3/presentation/annotation_page.rb +14 -15
- data/lib/iiif/v3/presentation/canvas.rb +21 -22
- data/lib/iiif/v3/presentation/choice.rb +14 -15
- data/lib/iiif/v3/presentation/collection.rb +7 -8
- data/lib/iiif/v3/presentation/image_resource.rb +21 -22
- data/lib/iiif/v3/presentation/manifest.rb +18 -19
- data/lib/iiif/v3/presentation/nav_place.rb +125 -29
- data/lib/iiif/v3/presentation/range.rb +10 -10
- data/lib/iiif/v3/presentation/resource.rb +4 -5
- data/lib/iiif/v3/presentation/sequence.rb +10 -11
- data/lib/iiif/v3/presentation/service.rb +12 -13
- data/lib/iiif/v3/presentation.rb +8 -8
- data/spec/integration/iiif/presentation/image_resource_spec.rb +54 -58
- data/spec/integration/iiif/service_spec.rb +76 -77
- data/spec/integration/iiif/v3/abstract_resource_spec.rb +72 -73
- data/spec/integration/iiif/v3/presentation/image_resource_spec.rb +53 -56
- data/spec/spec_helper.rb +56 -64
- data/spec/unit/iiif/hash_behaviours_spec.rb +384 -387
- data/spec/unit/iiif/ordered_hash_spec.rb +86 -91
- data/spec/unit/iiif/presentation/abstract_resource_spec.rb +64 -70
- data/spec/unit/iiif/presentation/annotation_list_spec.rb +1 -3
- data/spec/unit/iiif/presentation/annotation_spec.rb +1 -3
- data/spec/unit/iiif/presentation/canvas_spec.rb +11 -14
- data/spec/unit/iiif/presentation/collection_spec.rb +26 -33
- data/spec/unit/iiif/presentation/image_resource_spec.rb +4 -6
- data/spec/unit/iiif/presentation/layer_spec.rb +16 -20
- data/spec/unit/iiif/presentation/manifest_spec.rb +45 -48
- data/spec/unit/iiif/presentation/range_spec.rb +18 -22
- data/spec/unit/iiif/presentation/resource_spec.rb +3 -6
- data/spec/unit/iiif/presentation/sequence_spec.rb +58 -63
- data/spec/unit/iiif/presentation/shared_examples/abstract_resource_only_keys.rb +4 -10
- data/spec/unit/iiif/presentation/shared_examples/any_type_keys.rb +5 -9
- data/spec/unit/iiif/presentation/shared_examples/array_only_keys.rb +9 -17
- data/spec/unit/iiif/presentation/shared_examples/int_only_keys.rb +6 -14
- data/spec/unit/iiif/presentation/shared_examples/string_only_keys.rb +6 -13
- data/spec/unit/iiif/service_spec.rb +8 -13
- data/spec/unit/iiif/v3/abstract_resource_define_methods_for_spec.rb +39 -37
- data/spec/unit/iiif/v3/abstract_resource_spec.rb +124 -131
- data/spec/unit/iiif/v3/presentation/annotation_collection_spec.rb +14 -17
- data/spec/unit/iiif/v3/presentation/annotation_page_spec.rb +71 -69
- data/spec/unit/iiif/v3/presentation/annotation_spec.rb +249 -233
- data/spec/unit/iiif/v3/presentation/canvas_spec.rb +211 -193
- data/spec/unit/iiif/v3/presentation/choice_spec.rb +81 -77
- data/spec/unit/iiif/v3/presentation/collection_spec.rb +24 -29
- data/spec/unit/iiif/v3/presentation/image_resource_spec.rb +70 -71
- data/spec/unit/iiif/v3/presentation/manifest_spec.rb +248 -235
- data/spec/unit/iiif/v3/presentation/nav_place_spec.rb +249 -49
- data/spec/unit/iiif/v3/presentation/range_spec.rb +28 -29
- data/spec/unit/iiif/v3/presentation/resource_spec.rb +83 -82
- data/spec/unit/iiif/v3/presentation/sequence_spec.rb +125 -119
- data/spec/unit/iiif/v3/presentation/service_spec.rb +123 -124
- data/spec/unit/iiif/v3/presentation/shared_examples/abstract_resource_only_keys.rb +4 -8
- data/spec/unit/iiif/v3/presentation/shared_examples/any_type_keys.rb +5 -7
- data/spec/unit/iiif/v3/presentation/shared_examples/array_only_keys.rb +9 -13
- data/spec/unit/iiif/v3/presentation/shared_examples/hash_only_keys.rb +9 -13
- data/spec/unit/iiif/v3/presentation/shared_examples/int_only_keys.rb +6 -10
- data/spec/unit/iiif/v3/presentation/shared_examples/numeric_only_keys.rb +6 -10
- data/spec/unit/iiif/v3/presentation/shared_examples/string_only_keys.rb +6 -10
- data/spec/unit/iiif/v3/presentation/shared_examples/uri_only_keys.rb +9 -13
- metadata +26 -65
|
@@ -1,331 +1,349 @@
|
|
|
1
1
|
describe IIIF::V3::Presentation::Canvas do
|
|
2
|
+
describe "#required_keys" do
|
|
3
|
+
%w[type id label].each do |k|
|
|
4
|
+
it k do
|
|
5
|
+
expect(subject.required_keys).to include(k)
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
end
|
|
2
9
|
|
|
3
|
-
describe
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
viewing_direction
|
|
16
|
-
format
|
|
17
|
-
nav_date
|
|
18
|
-
start_canvas
|
|
19
|
-
content_annotations
|
|
20
|
-
}
|
|
21
|
-
expect(subject.prohibited_keys).to include(*keys)
|
|
22
|
-
end
|
|
10
|
+
describe "#prohibited_keys" do
|
|
11
|
+
it "contains the expected key names" do
|
|
12
|
+
keys = described_class::PAGING_PROPERTIES +
|
|
13
|
+
%w[
|
|
14
|
+
viewing_direction
|
|
15
|
+
format
|
|
16
|
+
nav_date
|
|
17
|
+
start_canvas
|
|
18
|
+
content_annotations
|
|
19
|
+
]
|
|
20
|
+
expect(subject.prohibited_keys).to include(*keys)
|
|
21
|
+
end
|
|
23
22
|
end
|
|
24
23
|
|
|
25
|
-
describe
|
|
26
|
-
it
|
|
27
|
-
expect(subject.int_only_keys).to include(
|
|
24
|
+
describe "#int_only_keys" do
|
|
25
|
+
it "depth (for 3d objects)" do
|
|
26
|
+
expect(subject.int_only_keys).to include("depth")
|
|
28
27
|
end
|
|
29
28
|
end
|
|
30
29
|
|
|
31
|
-
describe
|
|
32
|
-
it
|
|
33
|
-
expect(subject.array_only_keys).to include(
|
|
30
|
+
describe "#array_only_keys" do
|
|
31
|
+
it "content" do
|
|
32
|
+
expect(subject.array_only_keys).to include("content")
|
|
34
33
|
end
|
|
35
34
|
end
|
|
36
35
|
|
|
37
|
-
describe
|
|
38
|
-
it
|
|
39
|
-
expect(subject.legal_viewing_hint_values).to contain_exactly(
|
|
36
|
+
describe "#legal_viewing_hint_values" do
|
|
37
|
+
it "contains the expected values" do
|
|
38
|
+
expect(subject.legal_viewing_hint_values).to contain_exactly("paged", "continuous", "non-paged", "facing-pages", "auto-advance")
|
|
40
39
|
end
|
|
41
40
|
end
|
|
42
41
|
|
|
43
|
-
describe
|
|
44
|
-
it
|
|
45
|
-
expect(subject[
|
|
42
|
+
describe "#initialize" do
|
|
43
|
+
it "sets type to Canvas by default" do
|
|
44
|
+
expect(subject["type"]).to eq "Canvas"
|
|
46
45
|
end
|
|
47
|
-
it
|
|
46
|
+
it "allows subclasses to override type" do
|
|
48
47
|
subclass = Class.new(described_class) do
|
|
49
|
-
def initialize(
|
|
50
|
-
|
|
51
|
-
super(hsh)
|
|
48
|
+
def initialize(_hsh = {})
|
|
49
|
+
super({"type" => "a:SubClass"})
|
|
52
50
|
end
|
|
53
51
|
end
|
|
54
52
|
sub = subclass.new
|
|
55
|
-
expect(sub[
|
|
53
|
+
expect(sub["type"]).to eq "a:SubClass"
|
|
56
54
|
end
|
|
57
55
|
end
|
|
58
56
|
|
|
59
|
-
describe
|
|
60
|
-
let(:canvas_id) {
|
|
57
|
+
describe "#validate" do
|
|
58
|
+
let(:canvas_id) { "http://example.org/iiif/book1/canvas/c1" }
|
|
61
59
|
let(:exp_id_err_msg) { "id must be an http(s) URI without a fragment for #{described_class}" }
|
|
62
60
|
before(:each) do
|
|
63
|
-
subject[
|
|
64
|
-
subject[
|
|
61
|
+
subject["id"] = canvas_id
|
|
62
|
+
subject["label"] = "foo"
|
|
65
63
|
end
|
|
66
|
-
it
|
|
67
|
-
subject[
|
|
64
|
+
it "raises IllegalValueError if id is not URI" do
|
|
65
|
+
subject["id"] = "foo"
|
|
68
66
|
expect { subject.validate }.to raise_error(IIIF::V3::Presentation::IllegalValueError, exp_id_err_msg)
|
|
69
67
|
end
|
|
70
|
-
it
|
|
71
|
-
subject[
|
|
68
|
+
it "raises IllegalValueError if id is not http(s)" do
|
|
69
|
+
subject["id"] = "ftp://www.example.org"
|
|
72
70
|
expect { subject.validate }.to raise_error(IIIF::V3::Presentation::IllegalValueError, exp_id_err_msg)
|
|
73
71
|
end
|
|
74
|
-
it
|
|
75
|
-
subject[
|
|
72
|
+
it "raises IllegalValueError if id has a fragment" do
|
|
73
|
+
subject["id"] = "http://www.example.org#foo"
|
|
76
74
|
expect { subject.validate }.to raise_error(IIIF::V3::Presentation::IllegalValueError, exp_id_err_msg)
|
|
77
75
|
end
|
|
78
76
|
|
|
79
77
|
# let(:exp_extent_err_msg) { "#{described_class} must have (a height and a width) and/or a duration" }
|
|
80
78
|
# (see sul-dlss/purl/issues/169)
|
|
81
79
|
let(:exp_extent_err_msg) { "#{described_class} requires both height and width or neither" }
|
|
82
|
-
it
|
|
83
|
-
subject[
|
|
80
|
+
it "raises IllegalValueError if height is a string" do
|
|
81
|
+
subject["height"] = "foo"
|
|
84
82
|
expect { subject.validate }.to raise_error(IIIF::V3::Presentation::IllegalValueError, exp_extent_err_msg)
|
|
85
83
|
end
|
|
86
|
-
it
|
|
87
|
-
subject[
|
|
84
|
+
it "raises IllegalValueError if height but no width" do
|
|
85
|
+
subject["height"] = 666
|
|
88
86
|
expect { subject.validate }.to raise_error(IIIF::V3::Presentation::IllegalValueError, exp_extent_err_msg)
|
|
89
87
|
end
|
|
90
|
-
it
|
|
91
|
-
subject[
|
|
92
|
-
subject[
|
|
88
|
+
it "raises IllegalValueError if width but no height" do
|
|
89
|
+
subject["width"] = 666
|
|
90
|
+
subject["duration"] = 66.6
|
|
93
91
|
expect { subject.validate }.to raise_error(IIIF::V3::Presentation::IllegalValueError, exp_extent_err_msg)
|
|
94
92
|
end
|
|
95
|
-
it
|
|
93
|
+
it "raises IllegalValueError if no width, height or duration" do
|
|
96
94
|
# (see sul-dlss/purl/issues/169)
|
|
97
|
-
skip(
|
|
95
|
+
skip("while this is in the current v3 spec, it does not make sense for some content (e.g. txt files)")
|
|
98
96
|
expect { subject.validate }.to raise_error(IIIF::V3::Presentation::IllegalValueError, exp_extent_err_msg)
|
|
99
97
|
end
|
|
100
|
-
it
|
|
101
|
-
subject[
|
|
102
|
-
subject[
|
|
103
|
-
subject[
|
|
98
|
+
it "allows width, height and duration" do
|
|
99
|
+
subject["width"] = 666
|
|
100
|
+
subject["height"] = 666
|
|
101
|
+
subject["duration"] = 66.6
|
|
104
102
|
expect { subject.validate }.not_to raise_error
|
|
105
103
|
end
|
|
106
104
|
|
|
107
|
-
it
|
|
108
|
-
subject[
|
|
105
|
+
it "raises IllegalValueError for content entry that is not an AnnotationPage" do
|
|
106
|
+
subject["content"] = [IIIF::V3::Presentation::AnnotationPage.new, IIIF::V3::Presentation::Annotation.new]
|
|
109
107
|
exp_err_msg = "All entries in the content list must be a IIIF::V3::Presentation::AnnotationPage"
|
|
110
108
|
expect { subject.validate }.to raise_error(IIIF::V3::Presentation::IllegalValueError, exp_err_msg)
|
|
111
109
|
end
|
|
112
110
|
|
|
113
|
-
it
|
|
111
|
+
it "IllegalValueError for content with annotation target not the canvas id" do
|
|
114
112
|
anno = IIIF::V3::Presentation::Annotation.new(
|
|
115
|
-
|
|
116
|
-
|
|
113
|
+
"id" => "http://example.com/anno/666",
|
|
114
|
+
"target" => canvas_id
|
|
115
|
+
)
|
|
117
116
|
anno_page = IIIF::V3::Presentation::AnnotationPage.new(
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
117
|
+
"id" => "http://example.org/iiif/book1/page/p1/1",
|
|
118
|
+
"items" => [anno]
|
|
119
|
+
)
|
|
120
|
+
subject["content"] = [anno_page]
|
|
121
121
|
|
|
122
122
|
expect { subject.validate }.not_to raise_error
|
|
123
123
|
|
|
124
|
-
anno[
|
|
125
|
-
exp_err_msg =
|
|
124
|
+
anno["target"] = "http://example.com/canvas/abc"
|
|
125
|
+
exp_err_msg = "URI of the canvas must be repeated in the target field of included Annotations"
|
|
126
126
|
expect { subject.validate }.to raise_error(IIIF::V3::Presentation::IllegalValueError, exp_err_msg)
|
|
127
127
|
end
|
|
128
128
|
end
|
|
129
129
|
|
|
130
|
-
describe
|
|
131
|
-
let(:canvas_id) {
|
|
132
|
-
let(:minimal_canvas_object) {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
130
|
+
describe "realistic examples" do
|
|
131
|
+
let(:canvas_id) { "http://example.org/iiif/book1/canvas/c1" }
|
|
132
|
+
let(:minimal_canvas_object) {
|
|
133
|
+
described_class.new({
|
|
134
|
+
"id" => canvas_id,
|
|
135
|
+
"label" => {"en" => ["so minimal it's not here"]},
|
|
136
|
+
"height" => 1000,
|
|
137
|
+
"width" => 1000
|
|
138
|
+
})
|
|
139
|
+
}
|
|
140
|
+
let(:anno_page) {
|
|
141
|
+
IIIF::V3::Presentation::AnnotationPage.new(
|
|
142
|
+
"id" => "http://example.org/iiif/book1/page/p1/1",
|
|
143
|
+
"items" => []
|
|
144
|
+
)
|
|
145
|
+
}
|
|
146
|
+
describe "minimal canvas" do
|
|
147
|
+
it "validates" do
|
|
148
|
+
expect { minimal_canvas_object.validate }.not_to raise_error
|
|
145
149
|
end
|
|
146
|
-
it
|
|
150
|
+
it "has expected required values" do
|
|
147
151
|
expect(minimal_canvas_object.type).to eq described_class::TYPE
|
|
148
152
|
expect(minimal_canvas_object.id).to eq canvas_id
|
|
149
|
-
expect(minimal_canvas_object.label[
|
|
153
|
+
expect(minimal_canvas_object.label["en"]).to include "so minimal it's not here"
|
|
150
154
|
expect(minimal_canvas_object.height).to eq 1000
|
|
151
155
|
expect(minimal_canvas_object.width).to eq 1000
|
|
152
156
|
end
|
|
153
157
|
end
|
|
154
|
-
describe
|
|
158
|
+
describe "minimal with empty content" do
|
|
155
159
|
let(:canvas_object) {
|
|
156
|
-
minimal_canvas_object[
|
|
160
|
+
minimal_canvas_object["content"] = []
|
|
157
161
|
minimal_canvas_object
|
|
158
162
|
}
|
|
159
|
-
it
|
|
160
|
-
expect{canvas_object.validate}.not_to raise_error
|
|
163
|
+
it "validates" do
|
|
164
|
+
expect { canvas_object.validate }.not_to raise_error
|
|
161
165
|
end
|
|
162
|
-
it
|
|
166
|
+
it "has empty array for content" do
|
|
163
167
|
expect(canvas_object.content).to eq []
|
|
164
168
|
end
|
|
165
169
|
end
|
|
166
|
-
describe
|
|
170
|
+
describe "minimal with content" do
|
|
167
171
|
let(:canvas_object) {
|
|
168
|
-
minimal_canvas_object[
|
|
172
|
+
minimal_canvas_object["content"] = [anno_page, anno_page]
|
|
169
173
|
minimal_canvas_object
|
|
170
174
|
}
|
|
171
|
-
it
|
|
172
|
-
expect{canvas_object.validate}.not_to raise_error
|
|
175
|
+
it "validates" do
|
|
176
|
+
expect { canvas_object.validate }.not_to raise_error
|
|
173
177
|
end
|
|
174
|
-
it
|
|
178
|
+
it "has content value" do
|
|
175
179
|
expect(canvas_object.content.size).to eq 2
|
|
176
180
|
expect(canvas_object.content).to eq [anno_page, anno_page]
|
|
177
181
|
end
|
|
178
182
|
|
|
179
|
-
describe
|
|
183
|
+
describe "stanford (purl code)" do
|
|
180
184
|
let(:canvas_object) {
|
|
181
185
|
c = described_class.new
|
|
182
|
-
c[
|
|
183
|
-
c.label = {
|
|
186
|
+
c["id"] = canvas_id
|
|
187
|
+
c.label = {"en" => ["label"]}
|
|
184
188
|
c.content << anno_page
|
|
185
189
|
c
|
|
186
190
|
}
|
|
187
|
-
describe
|
|
188
|
-
it
|
|
189
|
-
expect{canvas_object.validate}.not_to raise_error
|
|
191
|
+
describe "non-image" do
|
|
192
|
+
it "validates" do
|
|
193
|
+
expect { canvas_object.validate }.not_to raise_error
|
|
190
194
|
end
|
|
191
|
-
it
|
|
195
|
+
it "has expected required values" do
|
|
192
196
|
expect(canvas_object.type).to eq described_class::TYPE
|
|
193
197
|
expect(canvas_object.id).to eq canvas_id
|
|
194
|
-
expect(canvas_object.label[
|
|
198
|
+
expect(canvas_object.label["en"]).to include "label"
|
|
195
199
|
end
|
|
196
|
-
it
|
|
200
|
+
it "has expected additional values" do
|
|
197
201
|
expect(canvas_object.content).to eq [anno_page]
|
|
198
202
|
end
|
|
199
203
|
end
|
|
200
|
-
describe
|
|
204
|
+
describe "image" do
|
|
201
205
|
let(:img_canvas) {
|
|
202
206
|
canvas_object.height = 666
|
|
203
207
|
canvas_object.width = 888
|
|
204
208
|
canvas_object
|
|
205
209
|
}
|
|
206
|
-
it
|
|
207
|
-
expect{img_canvas.validate}.not_to raise_error
|
|
210
|
+
it "validates" do
|
|
211
|
+
expect { img_canvas.validate }.not_to raise_error
|
|
208
212
|
end
|
|
209
|
-
it
|
|
213
|
+
it "has expected required values" do
|
|
210
214
|
expect(img_canvas.type).to eq described_class::TYPE
|
|
211
215
|
expect(img_canvas.id).to eq canvas_id
|
|
212
|
-
expect(img_canvas.label[
|
|
216
|
+
expect(img_canvas.label["en"]).to include "label"
|
|
213
217
|
expect(img_canvas.height).to eq 666
|
|
214
218
|
expect(img_canvas.width).to eq 888
|
|
215
219
|
end
|
|
216
|
-
it
|
|
220
|
+
it "has expected additional values" do
|
|
217
221
|
expect(img_canvas.content).to eq [anno_page]
|
|
218
222
|
end
|
|
219
223
|
end
|
|
220
224
|
end
|
|
221
225
|
|
|
222
|
-
describe
|
|
223
|
-
describe
|
|
224
|
-
let(:file_object) {
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
226
|
+
describe "file object" do
|
|
227
|
+
describe "without extent info" do
|
|
228
|
+
let(:file_object) {
|
|
229
|
+
described_class.new({
|
|
230
|
+
"id" => "https://example.org/bd742gh0511/iiif3/canvas/bd742gh0511_1",
|
|
231
|
+
"label" => {"en" => ["File 1"]},
|
|
232
|
+
"content" => [anno_page]
|
|
233
|
+
})
|
|
234
|
+
}
|
|
235
|
+
it "validates" do
|
|
236
|
+
expect { file_object.validate }.not_to raise_error
|
|
231
237
|
end
|
|
232
238
|
end
|
|
233
239
|
end
|
|
234
240
|
|
|
235
|
-
describe
|
|
236
|
-
describe
|
|
237
|
-
let(:image_object) {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
241
|
+
describe "image object" do
|
|
242
|
+
describe "without extent info" do
|
|
243
|
+
let(:image_object) {
|
|
244
|
+
described_class.new({
|
|
245
|
+
"id" => "https://example.org/yv090xk3108/iiif3/canvas/yv090xk3108_1",
|
|
246
|
+
"label" => {"en" => ["image"]},
|
|
247
|
+
"content" => [anno_page]
|
|
248
|
+
})
|
|
249
|
+
}
|
|
250
|
+
it "validates" do
|
|
251
|
+
expect { image_object.validate }.not_to raise_error
|
|
244
252
|
end
|
|
245
253
|
end
|
|
246
|
-
describe
|
|
247
|
-
let(:image_object) {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
254
|
+
describe "with extent given" do
|
|
255
|
+
let(:image_object) {
|
|
256
|
+
described_class.new({
|
|
257
|
+
"id" => "https://example.org/yy816tv6021/iiif3/canvas/yy816tv6021_3",
|
|
258
|
+
"label" => {"en" => ["Image of media (1 of 2)"]},
|
|
259
|
+
"height" => 3456,
|
|
260
|
+
"width" => 5184,
|
|
261
|
+
"content" => [anno_page]
|
|
262
|
+
})
|
|
263
|
+
}
|
|
264
|
+
it "validates" do
|
|
265
|
+
expect { image_object.validate }.not_to raise_error
|
|
256
266
|
end
|
|
257
267
|
end
|
|
258
268
|
end
|
|
259
269
|
|
|
260
|
-
describe
|
|
261
|
-
describe
|
|
262
|
-
let(:canvas_for_audio) {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
270
|
+
describe "audio object" do
|
|
271
|
+
describe "without duration" do
|
|
272
|
+
let(:canvas_for_audio) {
|
|
273
|
+
described_class.new({
|
|
274
|
+
"id" => "https://example.org/xk681bt2506/iiif3/canvas/xk681bt2506_1",
|
|
275
|
+
"label" => {"en" => ["Audio file 1"]},
|
|
276
|
+
"content" => [anno_page]
|
|
277
|
+
})
|
|
278
|
+
}
|
|
279
|
+
it "validates" do
|
|
280
|
+
expect { canvas_for_audio.validate }.not_to raise_error
|
|
269
281
|
end
|
|
270
282
|
end
|
|
271
|
-
describe
|
|
272
|
-
let(:canvas_for_audio) {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
+
describe "digerati example" do
|
|
284
|
+
let(:canvas_for_audio) {
|
|
285
|
+
described_class.new({
|
|
286
|
+
"id" => "http://tomcrane.github.io/scratch/manifests/3/canvas/2",
|
|
287
|
+
"label" => "Track 2",
|
|
288
|
+
"summary" => {
|
|
289
|
+
"en" => ["foo"]
|
|
290
|
+
},
|
|
291
|
+
"duration" => 45,
|
|
292
|
+
"content" => [anno_page]
|
|
293
|
+
})
|
|
294
|
+
}
|
|
295
|
+
it "validates" do
|
|
296
|
+
expect { canvas_for_audio.validate }.not_to raise_error
|
|
283
297
|
end
|
|
284
|
-
it
|
|
298
|
+
it "duration" do
|
|
285
299
|
expect(canvas_for_audio.duration).to eq 45
|
|
286
300
|
end
|
|
287
|
-
it
|
|
288
|
-
expect(canvas_for_audio.summary[
|
|
301
|
+
it "summary" do
|
|
302
|
+
expect(canvas_for_audio.summary["en"].first).to eq "foo"
|
|
289
303
|
end
|
|
290
304
|
end
|
|
291
305
|
end
|
|
292
306
|
|
|
293
|
-
describe
|
|
294
|
-
let(:canvas_3d_object) {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
307
|
+
describe "3d object" do
|
|
308
|
+
let(:canvas_3d_object) {
|
|
309
|
+
described_class.new({
|
|
310
|
+
"id" => "http://tomcrane.github.io/scratch/manifests/3/canvas/3d",
|
|
311
|
+
"thumbnail" => [{"id" => "http://files.universalviewer.io/manifests/nelis/animal-skull/thumb.jpg",
|
|
312
|
+
"type" => "Image"}],
|
|
313
|
+
"width" => 10000,
|
|
314
|
+
"height" => 10000,
|
|
315
|
+
"depth" => 10000,
|
|
316
|
+
"label" => "A stage for an object",
|
|
317
|
+
"content" => [anno_page]
|
|
318
|
+
})
|
|
319
|
+
}
|
|
320
|
+
it "validates" do
|
|
321
|
+
expect { canvas_3d_object.validate }.not_to raise_error
|
|
306
322
|
end
|
|
307
|
-
it
|
|
308
|
-
expect(canvas_3d_object.thumbnail).to eq [{
|
|
323
|
+
it "thumbnail" do
|
|
324
|
+
expect(canvas_3d_object.thumbnail).to eq [{"id" => "http://files.universalviewer.io/manifests/nelis/animal-skull/thumb.jpg", "type" => "Image"}]
|
|
309
325
|
end
|
|
310
|
-
it
|
|
326
|
+
it "depth" do
|
|
311
327
|
expect(canvas_3d_object.depth).to eq 10000
|
|
312
328
|
end
|
|
313
329
|
end
|
|
314
330
|
|
|
315
|
-
describe
|
|
316
|
-
describe
|
|
317
|
-
let(:canvas_for_video) {
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
331
|
+
describe "video object" do
|
|
332
|
+
describe "with extent info" do
|
|
333
|
+
let(:canvas_for_video) {
|
|
334
|
+
described_class.new({
|
|
335
|
+
"id" => "http://tomcrane.github.io/scratch/manifests/3/canvas/1",
|
|
336
|
+
"label" => "Associate multiple Video representations as Choice",
|
|
337
|
+
"height" => 1000,
|
|
338
|
+
"width" => 1000,
|
|
339
|
+
"duration" => 100,
|
|
340
|
+
"content" => [anno_page]
|
|
341
|
+
})
|
|
342
|
+
}
|
|
343
|
+
it "validates" do
|
|
344
|
+
expect { canvas_for_video.validate }.not_to raise_error
|
|
327
345
|
end
|
|
328
|
-
it
|
|
346
|
+
it "height, width, duration" do
|
|
329
347
|
expect(canvas_for_video.height).to eq 1000
|
|
330
348
|
expect(canvas_for_video.width).to eq 1000
|
|
331
349
|
expect(canvas_for_video.duration).to eq 100
|