aspose_slides_cloud 22.12.0 → 23.2.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/Gemfile.lock +5 -5
- data/README.md +12 -90
- data/lib/aspose_slides_cloud/api/slides_api.rb +167 -0
- data/lib/aspose_slides_cloud/models/effect.rb +12 -2
- data/lib/aspose_slides_cloud/models/hyperlink.rb +12 -2
- data/lib/aspose_slides_cloud/models/paragraph.rb +86 -76
- data/lib/aspose_slides_cloud/models/paragraph_format.rb +533 -0
- data/lib/aspose_slides_cloud/models/pdf_export_options.rb +2 -2
- data/lib/aspose_slides_cloud/models/text_frame_format.rb +202 -2
- data/lib/aspose_slides_cloud/type_registry.rb +1 -0
- data/lib/aspose_slides_cloud/version.rb +1 -1
- data/lib/aspose_slides_cloud.rb +1 -0
- data/spec/api/slides_api_spec.rb +233 -0
- data/spec/use_cases/font_spec.rb +21 -0
- data/spec/use_cases/shape_spec.rb +10 -0
- data/spec/use_cases/text_format_spec.rb +30 -0
- data/testRules.json +4 -1
- metadata +3 -2
@@ -31,6 +31,48 @@ module AsposeSlidesCloud
|
|
31
31
|
# Gets or sets text wrapping shape.
|
32
32
|
attr_accessor :transform
|
33
33
|
|
34
|
+
# Left margin. Left margin.
|
35
|
+
attr_accessor :margin_left
|
36
|
+
|
37
|
+
# Right margin.
|
38
|
+
attr_accessor :margin_right
|
39
|
+
|
40
|
+
# Top margin.
|
41
|
+
attr_accessor :margin_top
|
42
|
+
|
43
|
+
# Bottom margin.
|
44
|
+
attr_accessor :margin_bottom
|
45
|
+
|
46
|
+
# True if text is wrapped at TextFrame's margins.
|
47
|
+
attr_accessor :wrap_text
|
48
|
+
|
49
|
+
# Returns or sets vertical anchor text in a TextFrame.
|
50
|
+
attr_accessor :anchoring_type
|
51
|
+
|
52
|
+
# If True then text should be centered in box horizontally.
|
53
|
+
attr_accessor :center_text
|
54
|
+
|
55
|
+
# Determines text orientation. The resulted value of visual text rotation summarized from this property and custom angle in property RotationAngle.
|
56
|
+
attr_accessor :text_vertical_type
|
57
|
+
|
58
|
+
# Returns or sets text's auto-fit mode.
|
59
|
+
attr_accessor :autofit_type
|
60
|
+
|
61
|
+
# Returns or sets number of columns in the text area. This value must be a positive number. Otherwise, the value will be set to zero. Value 0 means undefined value.
|
62
|
+
attr_accessor :column_count
|
63
|
+
|
64
|
+
# Returns or sets the space between text columns in the text area (in points). This should only apply when there is more than 1 column present. This value must be a positive number. Otherwise, the value will be set to zero.
|
65
|
+
attr_accessor :column_spacing
|
66
|
+
|
67
|
+
# Returns or set keeping text out of 3D scene entirely.
|
68
|
+
attr_accessor :keep_text_flat
|
69
|
+
|
70
|
+
# Specifies the custom rotation that is being applied to the text within the bounding box.
|
71
|
+
attr_accessor :rotation_angle
|
72
|
+
|
73
|
+
# Default portion format.
|
74
|
+
attr_accessor :default_paragraph_format
|
75
|
+
|
34
76
|
class EnumAttributeValidator
|
35
77
|
attr_reader :datatype
|
36
78
|
attr_reader :allowable_values
|
@@ -58,6 +100,20 @@ module AsposeSlidesCloud
|
|
58
100
|
{
|
59
101
|
:'three_d_format' => :'ThreeDFormat',
|
60
102
|
:'transform' => :'Transform',
|
103
|
+
:'margin_left' => :'MarginLeft',
|
104
|
+
:'margin_right' => :'MarginRight',
|
105
|
+
:'margin_top' => :'MarginTop',
|
106
|
+
:'margin_bottom' => :'MarginBottom',
|
107
|
+
:'wrap_text' => :'WrapText',
|
108
|
+
:'anchoring_type' => :'AnchoringType',
|
109
|
+
:'center_text' => :'CenterText',
|
110
|
+
:'text_vertical_type' => :'TextVerticalType',
|
111
|
+
:'autofit_type' => :'AutofitType',
|
112
|
+
:'column_count' => :'ColumnCount',
|
113
|
+
:'column_spacing' => :'ColumnSpacing',
|
114
|
+
:'keep_text_flat' => :'KeepTextFlat',
|
115
|
+
:'rotation_angle' => :'RotationAngle',
|
116
|
+
:'default_paragraph_format' => :'DefaultParagraphFormat',
|
61
117
|
}
|
62
118
|
end
|
63
119
|
|
@@ -66,6 +122,20 @@ module AsposeSlidesCloud
|
|
66
122
|
{
|
67
123
|
:'three_d_format' => :'ThreeDFormat',
|
68
124
|
:'transform' => :'String',
|
125
|
+
:'margin_left' => :'Float',
|
126
|
+
:'margin_right' => :'Float',
|
127
|
+
:'margin_top' => :'Float',
|
128
|
+
:'margin_bottom' => :'Float',
|
129
|
+
:'wrap_text' => :'String',
|
130
|
+
:'anchoring_type' => :'String',
|
131
|
+
:'center_text' => :'String',
|
132
|
+
:'text_vertical_type' => :'String',
|
133
|
+
:'autofit_type' => :'String',
|
134
|
+
:'column_count' => :'Integer',
|
135
|
+
:'column_spacing' => :'Float',
|
136
|
+
:'keep_text_flat' => :'BOOLEAN',
|
137
|
+
:'rotation_angle' => :'Float',
|
138
|
+
:'default_paragraph_format' => :'ParagraphFormat',
|
69
139
|
}
|
70
140
|
end
|
71
141
|
|
@@ -84,6 +154,62 @@ module AsposeSlidesCloud
|
|
84
154
|
if attributes.has_key?(:'Transform')
|
85
155
|
self.transform = attributes[:'Transform']
|
86
156
|
end
|
157
|
+
|
158
|
+
if attributes.has_key?(:'MarginLeft')
|
159
|
+
self.margin_left = attributes[:'MarginLeft']
|
160
|
+
end
|
161
|
+
|
162
|
+
if attributes.has_key?(:'MarginRight')
|
163
|
+
self.margin_right = attributes[:'MarginRight']
|
164
|
+
end
|
165
|
+
|
166
|
+
if attributes.has_key?(:'MarginTop')
|
167
|
+
self.margin_top = attributes[:'MarginTop']
|
168
|
+
end
|
169
|
+
|
170
|
+
if attributes.has_key?(:'MarginBottom')
|
171
|
+
self.margin_bottom = attributes[:'MarginBottom']
|
172
|
+
end
|
173
|
+
|
174
|
+
if attributes.has_key?(:'WrapText')
|
175
|
+
self.wrap_text = attributes[:'WrapText']
|
176
|
+
end
|
177
|
+
|
178
|
+
if attributes.has_key?(:'AnchoringType')
|
179
|
+
self.anchoring_type = attributes[:'AnchoringType']
|
180
|
+
end
|
181
|
+
|
182
|
+
if attributes.has_key?(:'CenterText')
|
183
|
+
self.center_text = attributes[:'CenterText']
|
184
|
+
end
|
185
|
+
|
186
|
+
if attributes.has_key?(:'TextVerticalType')
|
187
|
+
self.text_vertical_type = attributes[:'TextVerticalType']
|
188
|
+
end
|
189
|
+
|
190
|
+
if attributes.has_key?(:'AutofitType')
|
191
|
+
self.autofit_type = attributes[:'AutofitType']
|
192
|
+
end
|
193
|
+
|
194
|
+
if attributes.has_key?(:'ColumnCount')
|
195
|
+
self.column_count = attributes[:'ColumnCount']
|
196
|
+
end
|
197
|
+
|
198
|
+
if attributes.has_key?(:'ColumnSpacing')
|
199
|
+
self.column_spacing = attributes[:'ColumnSpacing']
|
200
|
+
end
|
201
|
+
|
202
|
+
if attributes.has_key?(:'KeepTextFlat')
|
203
|
+
self.keep_text_flat = attributes[:'KeepTextFlat']
|
204
|
+
end
|
205
|
+
|
206
|
+
if attributes.has_key?(:'RotationAngle')
|
207
|
+
self.rotation_angle = attributes[:'RotationAngle']
|
208
|
+
end
|
209
|
+
|
210
|
+
if attributes.has_key?(:'DefaultParagraphFormat')
|
211
|
+
self.default_paragraph_format = attributes[:'DefaultParagraphFormat']
|
212
|
+
end
|
87
213
|
end
|
88
214
|
|
89
215
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -98,6 +224,16 @@ module AsposeSlidesCloud
|
|
98
224
|
def valid?
|
99
225
|
transform_validator = EnumAttributeValidator.new('String', ['None', 'Plain', 'Stop', 'Triangle', 'TriangleInverted', 'Chevron', 'ChevronInverted', 'RingInside', 'RingOutside', 'ArchUp', 'ArchDown', 'Circle', 'Button', 'ArchUpPour', 'ArchDownPour', 'CirclePour', 'ButtonPour', 'CurveUp', 'CurveDown', 'CanUp', 'CanDown', 'Wave1', 'Wave2', 'DoubleWave1', 'Wave4', 'Inflate', 'Deflate', 'InflateBottom', 'DeflateBottom', 'InflateTop', 'DeflateTop', 'DeflateInflate', 'DeflateInflateDeflate', 'FadeRight', 'FadeLeft', 'FadeUp', 'FadeDown', 'SlantUp', 'SlantDown', 'CascadeUp', 'CascadeDown', 'Custom', 'NotDefined'])
|
100
226
|
return false unless transform_validator.valid?(@transform)
|
227
|
+
wrap_text_validator = EnumAttributeValidator.new('String', ['False', 'True', 'NotDefined'])
|
228
|
+
return false unless wrap_text_validator.valid?(@wrap_text)
|
229
|
+
anchoring_type_validator = EnumAttributeValidator.new('String', ['Top', 'Center', 'Bottom', 'Justified', 'Distributed', 'NotDefined'])
|
230
|
+
return false unless anchoring_type_validator.valid?(@anchoring_type)
|
231
|
+
center_text_validator = EnumAttributeValidator.new('String', ['False', 'True', 'NotDefined'])
|
232
|
+
return false unless center_text_validator.valid?(@center_text)
|
233
|
+
text_vertical_type_validator = EnumAttributeValidator.new('String', ['Horizontal', 'Vertical', 'Vertical270', 'WordArtVertical', 'EastAsianVertical', 'MongolianVertical', 'WordArtVerticalRightToLeft', 'NotDefined'])
|
234
|
+
return false unless text_vertical_type_validator.valid?(@text_vertical_type)
|
235
|
+
autofit_type_validator = EnumAttributeValidator.new('String', ['None', 'Normal', 'Shape', 'NotDefined'])
|
236
|
+
return false unless autofit_type_validator.valid?(@autofit_type)
|
101
237
|
true
|
102
238
|
end
|
103
239
|
|
@@ -111,13 +247,77 @@ module AsposeSlidesCloud
|
|
111
247
|
@transform = transform
|
112
248
|
end
|
113
249
|
|
250
|
+
# Custom attribute writer method checking allowed values (enum).
|
251
|
+
# @param [Object] wrap_text Object to be assigned
|
252
|
+
def wrap_text=(wrap_text)
|
253
|
+
validator = EnumAttributeValidator.new('String', ['False', 'True', 'NotDefined'])
|
254
|
+
unless validator.valid?(wrap_text)
|
255
|
+
fail ArgumentError, 'invalid value for "wrap_text", must be one of #{validator.allowable_values}.'
|
256
|
+
end
|
257
|
+
@wrap_text = wrap_text
|
258
|
+
end
|
259
|
+
|
260
|
+
# Custom attribute writer method checking allowed values (enum).
|
261
|
+
# @param [Object] anchoring_type Object to be assigned
|
262
|
+
def anchoring_type=(anchoring_type)
|
263
|
+
validator = EnumAttributeValidator.new('String', ['Top', 'Center', 'Bottom', 'Justified', 'Distributed', 'NotDefined'])
|
264
|
+
unless validator.valid?(anchoring_type)
|
265
|
+
fail ArgumentError, 'invalid value for "anchoring_type", must be one of #{validator.allowable_values}.'
|
266
|
+
end
|
267
|
+
@anchoring_type = anchoring_type
|
268
|
+
end
|
269
|
+
|
270
|
+
# Custom attribute writer method checking allowed values (enum).
|
271
|
+
# @param [Object] center_text Object to be assigned
|
272
|
+
def center_text=(center_text)
|
273
|
+
validator = EnumAttributeValidator.new('String', ['False', 'True', 'NotDefined'])
|
274
|
+
unless validator.valid?(center_text)
|
275
|
+
fail ArgumentError, 'invalid value for "center_text", must be one of #{validator.allowable_values}.'
|
276
|
+
end
|
277
|
+
@center_text = center_text
|
278
|
+
end
|
279
|
+
|
280
|
+
# Custom attribute writer method checking allowed values (enum).
|
281
|
+
# @param [Object] text_vertical_type Object to be assigned
|
282
|
+
def text_vertical_type=(text_vertical_type)
|
283
|
+
validator = EnumAttributeValidator.new('String', ['Horizontal', 'Vertical', 'Vertical270', 'WordArtVertical', 'EastAsianVertical', 'MongolianVertical', 'WordArtVerticalRightToLeft', 'NotDefined'])
|
284
|
+
unless validator.valid?(text_vertical_type)
|
285
|
+
fail ArgumentError, 'invalid value for "text_vertical_type", must be one of #{validator.allowable_values}.'
|
286
|
+
end
|
287
|
+
@text_vertical_type = text_vertical_type
|
288
|
+
end
|
289
|
+
|
290
|
+
# Custom attribute writer method checking allowed values (enum).
|
291
|
+
# @param [Object] autofit_type Object to be assigned
|
292
|
+
def autofit_type=(autofit_type)
|
293
|
+
validator = EnumAttributeValidator.new('String', ['None', 'Normal', 'Shape', 'NotDefined'])
|
294
|
+
unless validator.valid?(autofit_type)
|
295
|
+
fail ArgumentError, 'invalid value for "autofit_type", must be one of #{validator.allowable_values}.'
|
296
|
+
end
|
297
|
+
@autofit_type = autofit_type
|
298
|
+
end
|
299
|
+
|
114
300
|
# Checks equality by comparing each attribute.
|
115
301
|
# @param [Object] Object to be compared
|
116
302
|
def ==(o)
|
117
303
|
return true if self.equal?(o)
|
118
304
|
self.class == o.class &&
|
119
305
|
three_d_format == o.three_d_format &&
|
120
|
-
transform == o.transform
|
306
|
+
transform == o.transform &&
|
307
|
+
margin_left == o.margin_left &&
|
308
|
+
margin_right == o.margin_right &&
|
309
|
+
margin_top == o.margin_top &&
|
310
|
+
margin_bottom == o.margin_bottom &&
|
311
|
+
wrap_text == o.wrap_text &&
|
312
|
+
anchoring_type == o.anchoring_type &&
|
313
|
+
center_text == o.center_text &&
|
314
|
+
text_vertical_type == o.text_vertical_type &&
|
315
|
+
autofit_type == o.autofit_type &&
|
316
|
+
column_count == o.column_count &&
|
317
|
+
column_spacing == o.column_spacing &&
|
318
|
+
keep_text_flat == o.keep_text_flat &&
|
319
|
+
rotation_angle == o.rotation_angle &&
|
320
|
+
default_paragraph_format == o.default_paragraph_format
|
121
321
|
end
|
122
322
|
|
123
323
|
# @see the `==` method
|
@@ -129,7 +329,7 @@ module AsposeSlidesCloud
|
|
129
329
|
# Calculates hash code according to all attributes.
|
130
330
|
# @return [Fixnum] Hash code
|
131
331
|
def hash
|
132
|
-
[three_d_format, transform].hash
|
332
|
+
[three_d_format, transform, margin_left, margin_right, margin_top, margin_bottom, wrap_text, anchoring_type, center_text, text_vertical_type, autofit_type, column_count, column_spacing, keep_text_flat, rotation_angle, default_paragraph_format].hash
|
133
333
|
end
|
134
334
|
|
135
335
|
# Builds the object from hash
|
@@ -374,6 +374,7 @@ module AsposeSlidesCloud
|
|
374
374
|
:'OuterShadowEffect' => { },
|
375
375
|
:'OutputFile' => { },
|
376
376
|
:'Paragraph' => { },
|
377
|
+
:'ParagraphFormat' => { },
|
377
378
|
:'Paragraphs' => { },
|
378
379
|
:'PathInputFile' => { :'Type' => 'Path', },
|
379
380
|
:'PathOutputFile' => { :'Type' => 'Path', },
|
data/lib/aspose_slides_cloud.rb
CHANGED
@@ -174,6 +174,7 @@ require 'aspose_slides_cloud/models/ordered_merge_request'
|
|
174
174
|
require 'aspose_slides_cloud/models/outer_shadow_effect'
|
175
175
|
require 'aspose_slides_cloud/models/output_file'
|
176
176
|
require 'aspose_slides_cloud/models/paragraph'
|
177
|
+
require 'aspose_slides_cloud/models/paragraph_format'
|
177
178
|
require 'aspose_slides_cloud/models/paragraphs'
|
178
179
|
require 'aspose_slides_cloud/models/path_input_file'
|
179
180
|
require 'aspose_slides_cloud/models/path_output_file'
|
data/spec/api/slides_api_spec.rb
CHANGED
@@ -636,6 +636,179 @@ describe 'SlidesApi' do
|
|
636
636
|
end
|
637
637
|
end
|
638
638
|
|
639
|
+
# unit tests for compress_embedded_fonts
|
640
|
+
# Compresses embedded fonts by removing unused characters.
|
641
|
+
# @param name Document name.
|
642
|
+
# @param [Hash] opts the optional parameters
|
643
|
+
# @option opts [String] :password Document password.
|
644
|
+
# @option opts [String] :folder Document folder.
|
645
|
+
# @option opts [String] :storage Document storage.
|
646
|
+
# @return [nil]
|
647
|
+
describe 'compress_embedded_fonts test' do
|
648
|
+
it 'should work' do
|
649
|
+
paramname = AsposeSlidesCloud::SpecUtils.get_param_value('name', 'CompressEmbeddedFonts', 'String')
|
650
|
+
parampassword = AsposeSlidesCloud::SpecUtils.get_param_value('password', 'CompressEmbeddedFonts', 'String')
|
651
|
+
paramfolder = AsposeSlidesCloud::SpecUtils.get_param_value('folder', 'CompressEmbeddedFonts', 'String')
|
652
|
+
paramstorage = AsposeSlidesCloud::SpecUtils.get_param_value('storage', 'CompressEmbeddedFonts', 'String')
|
653
|
+
AsposeSlidesCloud::SpecUtils.initialize('CompressEmbeddedFonts', nil, nil)
|
654
|
+
o, c, _h = AsposeSlidesCloud::SpecUtils.api.compress_embedded_fonts_with_http_info(paramname, parampassword, paramfolder, paramstorage)
|
655
|
+
code, message = AsposeSlidesCloud::SpecUtils.get_expected_error('CompressEmbeddedFonts', nil, nil, nil)
|
656
|
+
expect(c).to eq(code)
|
657
|
+
end
|
658
|
+
|
659
|
+
it 'invalid name' do
|
660
|
+
paramname = AsposeSlidesCloud::SpecUtils.get_param_value('name', 'CompressEmbeddedFonts', 'String')
|
661
|
+
parampassword = AsposeSlidesCloud::SpecUtils.get_param_value('password', 'CompressEmbeddedFonts', 'String')
|
662
|
+
paramfolder = AsposeSlidesCloud::SpecUtils.get_param_value('folder', 'CompressEmbeddedFonts', 'String')
|
663
|
+
paramstorage = AsposeSlidesCloud::SpecUtils.get_param_value('storage', 'CompressEmbeddedFonts', 'String')
|
664
|
+
paramname = AsposeSlidesCloud::SpecUtils.invalidize_param_value('name', 'CompressEmbeddedFonts', paramname, 'String')
|
665
|
+
AsposeSlidesCloud::SpecUtils.initialize('CompressEmbeddedFonts', 'name', paramname)
|
666
|
+
begin
|
667
|
+
AsposeSlidesCloud::SpecUtils.api.compress_embedded_fonts_with_http_info(paramname, parampassword, paramfolder, paramstorage)
|
668
|
+
unless AsposeSlidesCloud::SpecUtils.no_exception?('CompressEmbeddedFonts', 'name')
|
669
|
+
fail "An exception expected"
|
670
|
+
end
|
671
|
+
rescue AsposeSlidesCloud::ApiError => e
|
672
|
+
code, message = AsposeSlidesCloud::SpecUtils.get_expected_error('CompressEmbeddedFonts', 'name', paramname, 'String')
|
673
|
+
expect(e.code).to eq(code)
|
674
|
+
expect(e.response_body).to include(message)
|
675
|
+
rescue ArgumentError => e
|
676
|
+
code, message = AsposeSlidesCloud::SpecUtils.get_expected_error('CompressEmbeddedFonts', 'name', paramname, 'String')
|
677
|
+
expect(400).to eq(code)
|
678
|
+
expect(e.message).to include(message)
|
679
|
+
end
|
680
|
+
end
|
681
|
+
|
682
|
+
it 'invalid password' do
|
683
|
+
paramname = AsposeSlidesCloud::SpecUtils.get_param_value('name', 'CompressEmbeddedFonts', 'String')
|
684
|
+
parampassword = AsposeSlidesCloud::SpecUtils.get_param_value('password', 'CompressEmbeddedFonts', 'String')
|
685
|
+
paramfolder = AsposeSlidesCloud::SpecUtils.get_param_value('folder', 'CompressEmbeddedFonts', 'String')
|
686
|
+
paramstorage = AsposeSlidesCloud::SpecUtils.get_param_value('storage', 'CompressEmbeddedFonts', 'String')
|
687
|
+
parampassword = AsposeSlidesCloud::SpecUtils.invalidize_param_value('password', 'CompressEmbeddedFonts', parampassword, 'String')
|
688
|
+
AsposeSlidesCloud::SpecUtils.initialize('CompressEmbeddedFonts', 'password', parampassword)
|
689
|
+
begin
|
690
|
+
AsposeSlidesCloud::SpecUtils.api.compress_embedded_fonts_with_http_info(paramname, parampassword, paramfolder, paramstorage)
|
691
|
+
unless AsposeSlidesCloud::SpecUtils.no_exception?('CompressEmbeddedFonts', 'password')
|
692
|
+
fail "An exception expected"
|
693
|
+
end
|
694
|
+
rescue AsposeSlidesCloud::ApiError => e
|
695
|
+
code, message = AsposeSlidesCloud::SpecUtils.get_expected_error('CompressEmbeddedFonts', 'password', parampassword, 'String')
|
696
|
+
expect(e.code).to eq(code)
|
697
|
+
expect(e.response_body).to include(message)
|
698
|
+
rescue ArgumentError => e
|
699
|
+
code, message = AsposeSlidesCloud::SpecUtils.get_expected_error('CompressEmbeddedFonts', 'password', parampassword, 'String')
|
700
|
+
expect(400).to eq(code)
|
701
|
+
expect(e.message).to include(message)
|
702
|
+
end
|
703
|
+
end
|
704
|
+
|
705
|
+
it 'invalid folder' do
|
706
|
+
paramname = AsposeSlidesCloud::SpecUtils.get_param_value('name', 'CompressEmbeddedFonts', 'String')
|
707
|
+
parampassword = AsposeSlidesCloud::SpecUtils.get_param_value('password', 'CompressEmbeddedFonts', 'String')
|
708
|
+
paramfolder = AsposeSlidesCloud::SpecUtils.get_param_value('folder', 'CompressEmbeddedFonts', 'String')
|
709
|
+
paramstorage = AsposeSlidesCloud::SpecUtils.get_param_value('storage', 'CompressEmbeddedFonts', 'String')
|
710
|
+
paramfolder = AsposeSlidesCloud::SpecUtils.invalidize_param_value('folder', 'CompressEmbeddedFonts', paramfolder, 'String')
|
711
|
+
AsposeSlidesCloud::SpecUtils.initialize('CompressEmbeddedFonts', 'folder', paramfolder)
|
712
|
+
begin
|
713
|
+
AsposeSlidesCloud::SpecUtils.api.compress_embedded_fonts_with_http_info(paramname, parampassword, paramfolder, paramstorage)
|
714
|
+
unless AsposeSlidesCloud::SpecUtils.no_exception?('CompressEmbeddedFonts', 'folder')
|
715
|
+
fail "An exception expected"
|
716
|
+
end
|
717
|
+
rescue AsposeSlidesCloud::ApiError => e
|
718
|
+
code, message = AsposeSlidesCloud::SpecUtils.get_expected_error('CompressEmbeddedFonts', 'folder', paramfolder, 'String')
|
719
|
+
expect(e.code).to eq(code)
|
720
|
+
expect(e.response_body).to include(message)
|
721
|
+
rescue ArgumentError => e
|
722
|
+
code, message = AsposeSlidesCloud::SpecUtils.get_expected_error('CompressEmbeddedFonts', 'folder', paramfolder, 'String')
|
723
|
+
expect(400).to eq(code)
|
724
|
+
expect(e.message).to include(message)
|
725
|
+
end
|
726
|
+
end
|
727
|
+
|
728
|
+
it 'invalid storage' do
|
729
|
+
paramname = AsposeSlidesCloud::SpecUtils.get_param_value('name', 'CompressEmbeddedFonts', 'String')
|
730
|
+
parampassword = AsposeSlidesCloud::SpecUtils.get_param_value('password', 'CompressEmbeddedFonts', 'String')
|
731
|
+
paramfolder = AsposeSlidesCloud::SpecUtils.get_param_value('folder', 'CompressEmbeddedFonts', 'String')
|
732
|
+
paramstorage = AsposeSlidesCloud::SpecUtils.get_param_value('storage', 'CompressEmbeddedFonts', 'String')
|
733
|
+
paramstorage = AsposeSlidesCloud::SpecUtils.invalidize_param_value('storage', 'CompressEmbeddedFonts', paramstorage, 'String')
|
734
|
+
AsposeSlidesCloud::SpecUtils.initialize('CompressEmbeddedFonts', 'storage', paramstorage)
|
735
|
+
begin
|
736
|
+
AsposeSlidesCloud::SpecUtils.api.compress_embedded_fonts_with_http_info(paramname, parampassword, paramfolder, paramstorage)
|
737
|
+
unless AsposeSlidesCloud::SpecUtils.no_exception?('CompressEmbeddedFonts', 'storage')
|
738
|
+
fail "An exception expected"
|
739
|
+
end
|
740
|
+
rescue AsposeSlidesCloud::ApiError => e
|
741
|
+
code, message = AsposeSlidesCloud::SpecUtils.get_expected_error('CompressEmbeddedFonts', 'storage', paramstorage, 'String')
|
742
|
+
expect(e.code).to eq(code)
|
743
|
+
expect(e.response_body).to include(message)
|
744
|
+
rescue ArgumentError => e
|
745
|
+
code, message = AsposeSlidesCloud::SpecUtils.get_expected_error('CompressEmbeddedFonts', 'storage', paramstorage, 'String')
|
746
|
+
expect(400).to eq(code)
|
747
|
+
expect(e.message).to include(message)
|
748
|
+
end
|
749
|
+
end
|
750
|
+
end
|
751
|
+
|
752
|
+
# unit tests for compress_embedded_fonts_online
|
753
|
+
# Compresses embedded fonts by removing unused characters.
|
754
|
+
# @param document Document data.
|
755
|
+
# @param [Hash] opts the optional parameters
|
756
|
+
# @option opts [String] :password Document password.
|
757
|
+
# @return [File]
|
758
|
+
describe 'compress_embedded_fonts_online test' do
|
759
|
+
it 'should work' do
|
760
|
+
paramdocument = AsposeSlidesCloud::SpecUtils.get_param_value('document', 'CompressEmbeddedFontsOnline', 'File')
|
761
|
+
parampassword = AsposeSlidesCloud::SpecUtils.get_param_value('password', 'CompressEmbeddedFontsOnline', 'String')
|
762
|
+
AsposeSlidesCloud::SpecUtils.initialize('CompressEmbeddedFontsOnline', nil, nil)
|
763
|
+
o, c, _h = AsposeSlidesCloud::SpecUtils.api.compress_embedded_fonts_online_with_http_info(paramdocument, parampassword)
|
764
|
+
code, message = AsposeSlidesCloud::SpecUtils.get_expected_error('CompressEmbeddedFontsOnline', nil, nil, nil)
|
765
|
+
expect(c).to eq(code)
|
766
|
+
expect(o).not_to be_nil
|
767
|
+
end
|
768
|
+
|
769
|
+
it 'invalid document' do
|
770
|
+
paramdocument = AsposeSlidesCloud::SpecUtils.get_param_value('document', 'CompressEmbeddedFontsOnline', 'File')
|
771
|
+
parampassword = AsposeSlidesCloud::SpecUtils.get_param_value('password', 'CompressEmbeddedFontsOnline', 'String')
|
772
|
+
paramdocument = AsposeSlidesCloud::SpecUtils.invalidize_param_value('document', 'CompressEmbeddedFontsOnline', paramdocument, 'File')
|
773
|
+
AsposeSlidesCloud::SpecUtils.initialize('CompressEmbeddedFontsOnline', 'document', paramdocument)
|
774
|
+
begin
|
775
|
+
AsposeSlidesCloud::SpecUtils.api.compress_embedded_fonts_online_with_http_info(paramdocument, parampassword)
|
776
|
+
unless AsposeSlidesCloud::SpecUtils.no_exception?('CompressEmbeddedFontsOnline', 'document')
|
777
|
+
fail "An exception expected"
|
778
|
+
end
|
779
|
+
rescue AsposeSlidesCloud::ApiError => e
|
780
|
+
code, message = AsposeSlidesCloud::SpecUtils.get_expected_error('CompressEmbeddedFontsOnline', 'document', paramdocument, 'File')
|
781
|
+
expect(e.code).to eq(code)
|
782
|
+
expect(e.response_body).to include(message)
|
783
|
+
rescue ArgumentError => e
|
784
|
+
code, message = AsposeSlidesCloud::SpecUtils.get_expected_error('CompressEmbeddedFontsOnline', 'document', paramdocument, 'File')
|
785
|
+
expect(400).to eq(code)
|
786
|
+
expect(e.message).to include(message)
|
787
|
+
end
|
788
|
+
end
|
789
|
+
|
790
|
+
it 'invalid password' do
|
791
|
+
paramdocument = AsposeSlidesCloud::SpecUtils.get_param_value('document', 'CompressEmbeddedFontsOnline', 'File')
|
792
|
+
parampassword = AsposeSlidesCloud::SpecUtils.get_param_value('password', 'CompressEmbeddedFontsOnline', 'String')
|
793
|
+
parampassword = AsposeSlidesCloud::SpecUtils.invalidize_param_value('password', 'CompressEmbeddedFontsOnline', parampassword, 'String')
|
794
|
+
AsposeSlidesCloud::SpecUtils.initialize('CompressEmbeddedFontsOnline', 'password', parampassword)
|
795
|
+
begin
|
796
|
+
AsposeSlidesCloud::SpecUtils.api.compress_embedded_fonts_online_with_http_info(paramdocument, parampassword)
|
797
|
+
unless AsposeSlidesCloud::SpecUtils.no_exception?('CompressEmbeddedFontsOnline', 'password')
|
798
|
+
fail "An exception expected"
|
799
|
+
end
|
800
|
+
rescue AsposeSlidesCloud::ApiError => e
|
801
|
+
code, message = AsposeSlidesCloud::SpecUtils.get_expected_error('CompressEmbeddedFontsOnline', 'password', parampassword, 'String')
|
802
|
+
expect(e.code).to eq(code)
|
803
|
+
expect(e.response_body).to include(message)
|
804
|
+
rescue ArgumentError => e
|
805
|
+
code, message = AsposeSlidesCloud::SpecUtils.get_expected_error('CompressEmbeddedFontsOnline', 'password', parampassword, 'String')
|
806
|
+
expect(400).to eq(code)
|
807
|
+
expect(e.message).to include(message)
|
808
|
+
end
|
809
|
+
end
|
810
|
+
end
|
811
|
+
|
639
812
|
# unit tests for convert
|
640
813
|
# Convert presentation from request content to format specified.
|
641
814
|
# @param document Document data.
|
@@ -20286,6 +20459,66 @@ describe 'SlidesApi' do
|
|
20286
20459
|
end
|
20287
20460
|
end
|
20288
20461
|
|
20462
|
+
# unit tests for download_shape_from_dto
|
20463
|
+
# Creates the shape from the DTO and returns the result in the specified format.
|
20464
|
+
# @param format Export format
|
20465
|
+
# @param dto Shape DTO.
|
20466
|
+
# @param [Hash] opts the optional parameters
|
20467
|
+
# @return [File]
|
20468
|
+
describe 'download_shape_from_dto test' do
|
20469
|
+
it 'should work' do
|
20470
|
+
paramformat = AsposeSlidesCloud::SpecUtils.get_param_value('format', 'DownloadShapeFromDto', 'String')
|
20471
|
+
paramdto = AsposeSlidesCloud::SpecUtils.get_param_value('dto', 'DownloadShapeFromDto', 'ShapeBase')
|
20472
|
+
AsposeSlidesCloud::SpecUtils.initialize('DownloadShapeFromDto', nil, nil)
|
20473
|
+
o, c, _h = AsposeSlidesCloud::SpecUtils.api.download_shape_from_dto_with_http_info(paramformat, paramdto)
|
20474
|
+
code, message = AsposeSlidesCloud::SpecUtils.get_expected_error('DownloadShapeFromDto', nil, nil, nil)
|
20475
|
+
expect(c).to eq(code)
|
20476
|
+
expect(o).not_to be_nil
|
20477
|
+
end
|
20478
|
+
|
20479
|
+
it 'invalid format' do
|
20480
|
+
paramformat = AsposeSlidesCloud::SpecUtils.get_param_value('format', 'DownloadShapeFromDto', 'String')
|
20481
|
+
paramdto = AsposeSlidesCloud::SpecUtils.get_param_value('dto', 'DownloadShapeFromDto', 'ShapeBase')
|
20482
|
+
paramformat = AsposeSlidesCloud::SpecUtils.invalidize_param_value('format', 'DownloadShapeFromDto', paramformat, 'String')
|
20483
|
+
AsposeSlidesCloud::SpecUtils.initialize('DownloadShapeFromDto', 'format', paramformat)
|
20484
|
+
begin
|
20485
|
+
AsposeSlidesCloud::SpecUtils.api.download_shape_from_dto_with_http_info(paramformat, paramdto)
|
20486
|
+
unless AsposeSlidesCloud::SpecUtils.no_exception?('DownloadShapeFromDto', 'format')
|
20487
|
+
fail "An exception expected"
|
20488
|
+
end
|
20489
|
+
rescue AsposeSlidesCloud::ApiError => e
|
20490
|
+
code, message = AsposeSlidesCloud::SpecUtils.get_expected_error('DownloadShapeFromDto', 'format', paramformat, 'String')
|
20491
|
+
expect(e.code).to eq(code)
|
20492
|
+
expect(e.response_body).to include(message)
|
20493
|
+
rescue ArgumentError => e
|
20494
|
+
code, message = AsposeSlidesCloud::SpecUtils.get_expected_error('DownloadShapeFromDto', 'format', paramformat, 'String')
|
20495
|
+
expect(400).to eq(code)
|
20496
|
+
expect(e.message).to include(message)
|
20497
|
+
end
|
20498
|
+
end
|
20499
|
+
|
20500
|
+
it 'invalid dto' do
|
20501
|
+
paramformat = AsposeSlidesCloud::SpecUtils.get_param_value('format', 'DownloadShapeFromDto', 'String')
|
20502
|
+
paramdto = AsposeSlidesCloud::SpecUtils.get_param_value('dto', 'DownloadShapeFromDto', 'ShapeBase')
|
20503
|
+
paramdto = AsposeSlidesCloud::SpecUtils.invalidize_param_value('dto', 'DownloadShapeFromDto', paramdto, 'ShapeBase')
|
20504
|
+
AsposeSlidesCloud::SpecUtils.initialize('DownloadShapeFromDto', 'dto', paramdto)
|
20505
|
+
begin
|
20506
|
+
AsposeSlidesCloud::SpecUtils.api.download_shape_from_dto_with_http_info(paramformat, paramdto)
|
20507
|
+
unless AsposeSlidesCloud::SpecUtils.no_exception?('DownloadShapeFromDto', 'dto')
|
20508
|
+
fail "An exception expected"
|
20509
|
+
end
|
20510
|
+
rescue AsposeSlidesCloud::ApiError => e
|
20511
|
+
code, message = AsposeSlidesCloud::SpecUtils.get_expected_error('DownloadShapeFromDto', 'dto', paramdto, 'ShapeBase')
|
20512
|
+
expect(e.code).to eq(code)
|
20513
|
+
expect(e.response_body).to include(message)
|
20514
|
+
rescue ArgumentError => e
|
20515
|
+
code, message = AsposeSlidesCloud::SpecUtils.get_expected_error('DownloadShapeFromDto', 'dto', paramdto, 'ShapeBase')
|
20516
|
+
expect(400).to eq(code)
|
20517
|
+
expect(e.message).to include(message)
|
20518
|
+
end
|
20519
|
+
end
|
20520
|
+
end
|
20521
|
+
|
20289
20522
|
# unit tests for download_shape_online
|
20290
20523
|
# Render shape to specified picture format.
|
20291
20524
|
# @param document Document data.
|
data/spec/use_cases/font_spec.rb
CHANGED
@@ -78,6 +78,27 @@ describe 'UseCases' do
|
|
78
78
|
expect(response.size).not_to eq(sourceDocument.size)
|
79
79
|
end
|
80
80
|
|
81
|
+
it "compress embedded fonts" do
|
82
|
+
folder_name = "TempSlidesSDK"
|
83
|
+
file_name = "test.pptx"
|
84
|
+
font_name = "Calibri"
|
85
|
+
AsposeSlidesCloud::SpecUtils.api.copy_file("TempTests/" + file_name, folder_name + "/" + file_name)
|
86
|
+
response = AsposeSlidesCloud::SpecUtils.api.set_embedded_font(file_name, font_name, false, "password", folder_name)
|
87
|
+
expect(response.list[2].is_embedded).to eq(true)
|
88
|
+
#In a real world example, you would rather get the same result by calling set_embedded_font with onlyUsed = true
|
89
|
+
AsposeSlidesCloud::SpecUtils.api.compress_embedded_fonts(file_name, "password", folder_name)
|
90
|
+
end
|
91
|
+
|
92
|
+
it "compress embedded fonts online" do
|
93
|
+
source = File.binread("TestData/test.pptx")
|
94
|
+
font_name = "Calibri"
|
95
|
+
response_embedded = AsposeSlidesCloud::SpecUtils.api.set_embedded_font_online(source, font_name, false, "password")
|
96
|
+
expect(response_embedded.size).not_to eq(source.size)
|
97
|
+
#In a real world example, you would rather get the same result by calling set_embedded_font with onlyUsed = true
|
98
|
+
response_compressed = AsposeSlidesCloud::SpecUtils.api.compress_embedded_fonts_online(response_embedded, "password")
|
99
|
+
expect(response_compressed.size).to be < response_embedded.size
|
100
|
+
end
|
101
|
+
|
81
102
|
it "delete embedded font" do
|
82
103
|
folder_name = "TempSlidesSDK"
|
83
104
|
file_name = "test.pptx"
|
@@ -590,5 +590,15 @@ describe 'UseCases' do
|
|
590
590
|
sub_node_path, "password", folder_name)
|
591
591
|
expect(response.nodes[0].nodes.length).to eq(3)
|
592
592
|
end
|
593
|
+
|
594
|
+
it "download shape from DTO" do
|
595
|
+
shape = AsposeSlidesCloud::Shape.new
|
596
|
+
shape.shape_type = "Rectangle"
|
597
|
+
shape.width = 400
|
598
|
+
shape.height = 200
|
599
|
+
shape.text = "Shape text"
|
600
|
+
|
601
|
+
response = AsposeSlidesCloud::SpecUtils.api.download_shape_from_dto(AsposeSlidesCloud::ShapeExportFormat::PNG, shape)
|
602
|
+
end
|
593
603
|
end
|
594
604
|
end
|
@@ -70,5 +70,35 @@ describe 'UseCases' do
|
|
70
70
|
result = AsposeSlidesCloud::SpecUtils.api.create_shape(file_name, slide_index, dto, nil, nil, password, folder_name)
|
71
71
|
expect(result).to be_kind_of(AsposeSlidesCloud::Shape)
|
72
72
|
end
|
73
|
+
|
74
|
+
it "text frame format" do
|
75
|
+
folder_name = "TempSlidesSDK"
|
76
|
+
file_name = "test.pptx"
|
77
|
+
password = "password"
|
78
|
+
slide_index = 1
|
79
|
+
AsposeSlidesCloud::SpecUtils.api.copy_file("TempTests/" + file_name, folder_name + "/" + file_name)
|
80
|
+
|
81
|
+
dto = AsposeSlidesCloud::Shape.new
|
82
|
+
dto.shape_type = "Rectangle"
|
83
|
+
dto.x = 100
|
84
|
+
dto.y = 100
|
85
|
+
dto.height = 100
|
86
|
+
dto.width = 200
|
87
|
+
dto.text = "Sample text"
|
88
|
+
|
89
|
+
dto.text_frame_format = AsposeSlidesCloud::TextFrameFormat.new
|
90
|
+
dto.text_frame_format.center_text = "True"
|
91
|
+
dto.text_frame_format.margin_left = 2
|
92
|
+
dto.text_frame_format.margin_right = 2
|
93
|
+
dto.text_frame_format.margin_top = 2
|
94
|
+
dto.text_frame_format.margin_bottom = 2
|
95
|
+
dto.text_frame_format.default_paragraph_format = AsposeSlidesCloud::ParagraphFormat.new
|
96
|
+
solidFill = AsposeSlidesCloud::SolidFill.new
|
97
|
+
solidFill.color = "#FF0000"
|
98
|
+
dto.text_frame_format.default_paragraph_format.bullet_fill_format = solidFill
|
99
|
+
|
100
|
+
result = AsposeSlidesCloud::SpecUtils.api.create_shape(file_name, slide_index, dto, nil, nil, password, folder_name)
|
101
|
+
expect(result).to be_kind_of(AsposeSlidesCloud::Shape)
|
102
|
+
end
|
73
103
|
end
|
74
104
|
end
|
data/testRules.json
CHANGED
@@ -18,7 +18,8 @@
|
|
18
18
|
{ "Action": "Delete", "Folder": "TempSlidesSDKinvalid", "File": "changedtest.pptx", "Method": "/CreatePresentationFrom/" },
|
19
19
|
{ "Action": "Delete", "Folder": "invalidTempSlidesSDK", "File": "test.pptx", "Method": "/CreatePresentationFrom/" },
|
20
20
|
{ "Action": "Delete", "Folder": "invalidTempSlidesSDK", "File": "test.pptx", "Parameter": "CloneFrom" },
|
21
|
-
{ "Action": "Delete", "Folder": "invalidTempSlidesSDK", "File": "test.pptx", "Parameter": "/S.?.?rc.?Path/" }
|
21
|
+
{ "Action": "Delete", "Folder": "invalidTempSlidesSDK", "File": "test.pptx", "Parameter": "/S.?.?rc.?Path/" },
|
22
|
+
{ "Action": "Delete", "Folder": "", "File": "NewTestFolder", "Method": "CreateFolder" }
|
22
23
|
],
|
23
24
|
"Values": [
|
24
25
|
{ "Value": "test%n", "InvalidValue": "%vinvalid" },
|
@@ -44,6 +45,7 @@
|
|
44
45
|
{ "Value": [2, 1], "Parameter": "OldPositions" },
|
45
46
|
{ "Value": [1, 2], "Parameter": "NewPositions" },
|
46
47
|
{ "Value": {}, "InvalidValue": null, "Type": "model" },
|
48
|
+
{ "Value": { "Type": "Shape", "ShapeType": "Rectangle" }, "InvalidValue": null, "Type": "Shape" },
|
47
49
|
{ "Value": { "MasterSlide": { "Href": "masterSlides/2" } }, "Type": "LayoutSlide" },
|
48
50
|
{ "Value": { "DataPointType": "OneValue" }, "Type": "OneValueSeries" },
|
49
51
|
{ "Value": { "Type": "Scatter", "XValue": 32.5, "YValue": 42.9 }, "Type": "ScatterChartDataPoint" },
|
@@ -78,6 +80,7 @@
|
|
78
80
|
{ "Value": null, "Parameter": "SubNode" },
|
79
81
|
{ "Value": null, "Parameter": "SubShape" },
|
80
82
|
{ "Value": "TempSlidesSDK/test.pptx", "InvalidValue": "invalid%v", "Parameter": "/Path/" },
|
83
|
+
{ "Value": "NewTestFolder", "Parameter": "Path", "Method": "CreateFolder" },
|
81
84
|
{ "Value": "TempSlidesSDK", "Parameter": "Path", "Method": "DeleteFolder" },
|
82
85
|
{ "Value": "TempSlidesSDK/changedtest.pptx", "Parameter": "DestPath" },
|
83
86
|
{ "Value": "TempSlidesSDK/test.pptx", "InvalidValue": "invalid%v", "Parameter": "CloneFrom" },
|