cairo 1.17.6 → 1.17.7

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.
@@ -119,6 +119,13 @@ class FontFaceTest < Test::Unit::TestCase
119
119
  render_glyph_args << args
120
120
  end
121
121
 
122
+ render_color_glyph_args = []
123
+ if face.respond_to?(:on_render_color_glyph)
124
+ face.on_render_color_glyph do |*args|
125
+ render_color_glyph_args << args
126
+ end
127
+ end
128
+
122
129
  text_to_glyphs_args = []
123
130
  face.on_text_to_glyphs do |*args|
124
131
  text_to_glyphs_args << args
@@ -137,26 +144,42 @@ class FontFaceTest < Test::Unit::TestCase
137
144
  Cairo::Matrix.identity,
138
145
  Cairo::Matrix.identity,
139
146
  Cairo::FontOptions.new)
140
- result = scaled_font.text_to_glyphs(0, 0, "text")
141
- assert_equal([[[Cairo::ScaledFont, Cairo::Context, Cairo::FontExtents]],
142
- [[Cairo::ScaledFont, codepoint("t"),
143
- Cairo::Context, Cairo::TextExtents],
144
- [Cairo::ScaledFont, codepoint("e"),
145
- Cairo::Context, Cairo::TextExtents],
146
- [Cairo::ScaledFont, codepoint("x"),
147
- Cairo::Context, Cairo::TextExtents]],
148
- [[Cairo::ScaledFont, "text",
149
- Cairo::UserFontFace::TextToGlyphsData]],
150
- [[Cairo::ScaledFont, codepoint("t")],
151
- [Cairo::ScaledFont, codepoint("e")],
152
- [Cairo::ScaledFont, codepoint("x")],
153
- [Cairo::ScaledFont, codepoint("t")]],
154
- [[], [], Cairo::TextClusterFlag::BACKWARD]],
155
- [classify_cairo_object(init_args),
156
- classify_cairo_object(render_glyph_args),
157
- classify_cairo_object(text_to_glyphs_args),
158
- classify_cairo_object(unicode_to_glyph_args),
159
- result])
147
+ result = scaled_font.text_to_glyphs(0, 0, "abc")
148
+ expected = {
149
+ init_args: [
150
+ [Cairo::ScaledFont, Cairo::Context, Cairo::FontExtents],
151
+ ],
152
+ render_glyph_args: [
153
+ [Cairo::ScaledFont, codepoint("a"), Cairo::Context, Cairo::TextExtents],
154
+ [Cairo::ScaledFont, codepoint("b"), Cairo::Context, Cairo::TextExtents],
155
+ [Cairo::ScaledFont, codepoint("c"), Cairo::Context, Cairo::TextExtents],
156
+ ],
157
+ render_color_glyph_args: [],
158
+ text_to_glyphs_args: [
159
+ [Cairo::ScaledFont, "abc", Cairo::UserFontFace::TextToGlyphsData],
160
+ ],
161
+ unicode_to_glyph_args: [
162
+ [Cairo::ScaledFont, codepoint("a")],
163
+ [Cairo::ScaledFont, codepoint("b")],
164
+ [Cairo::ScaledFont, codepoint("c")],
165
+ ],
166
+ result: [[], [], Cairo::TextClusterFlag::BACKWARD],
167
+ }
168
+ actual = {
169
+ init_args: classify_cairo_object(init_args),
170
+ render_glyph_args: classify_cairo_object(render_glyph_args),
171
+ render_color_glyph_args: classify_cairo_object(render_color_glyph_args),
172
+ text_to_glyphs_args: classify_cairo_object(text_to_glyphs_args),
173
+ unicode_to_glyph_args: classify_cairo_object(unicode_to_glyph_args),
174
+ result: result,
175
+ }
176
+ if Cairo.satisfied_version?(1, 17, 6)
177
+ expected[:render_glyph_args],
178
+ expected[:render_color_glyph_args] =
179
+ expected[:render_color_glyph_args],
180
+ expected[:render_glyph_args]
181
+ end
182
+ assert_equal(expected, actual)
160
183
  end
161
184
 
162
185
  if Cairo.satisfied_version?(1, 7, 2)
@@ -210,103 +233,54 @@ class FontFaceTest < Test::Unit::TestCase
210
233
  Cairo::Matrix.identity,
211
234
  Cairo::Matrix.identity,
212
235
  Cairo::FontOptions.new)
213
- result = scaled_font.text_to_glyphs(0, 0, "text")
236
+ result = scaled_font.text_to_glyphs(0, 0, "abc")
237
+ expected = {
238
+ init_args: [
239
+ [Cairo::ScaledFont, Cairo::Context, Cairo::FontExtents]
240
+ ],
241
+ text_to_glyphs_args: [
242
+ [Cairo::ScaledFont, "abc", Cairo::UserFontFace::TextToGlyphsData],
243
+ ],
244
+ unicode_to_glyph_args: [
245
+ [Cairo::ScaledFont, codepoint("a")],
246
+ [Cairo::ScaledFont, codepoint("b")],
247
+ [Cairo::ScaledFont, codepoint("c")],
248
+ ],
249
+ result: [
250
+ [],
251
+ [],
252
+ Cairo::TextClusterFlag::BACKWARD,
253
+ ],
254
+ }
255
+ actual = {
256
+ init_args: classify_cairo_object(face.init_args),
257
+ text_to_glyphs_args:
258
+ classify_cairo_object(face.text_to_glyphs_args),
259
+ unicode_to_glyph_args:
260
+ classify_cairo_object(face.unicode_to_glyph_args),
261
+ result: result,
262
+ }
214
263
  if Cairo.satisfied_version?(1, 17, 6)
215
- assert_equal({
216
- init_args: [
217
- [Cairo::ScaledFont, Cairo::Context, Cairo::FontExtents]
218
- ],
219
- render_glyph_args: [],
220
- render_color_glyph_args: [
221
- [
222
- Cairo::ScaledFont, codepoint("t"),
223
- Cairo::Context, Cairo::TextExtents,
224
- ],
225
- [
226
- Cairo::ScaledFont, codepoint("e"),
227
- Cairo::Context, Cairo::TextExtents,
228
- ],
229
- [
230
- Cairo::ScaledFont, codepoint("x"),
231
- Cairo::Context, Cairo::TextExtents,
232
- ],
233
- ],
234
- text_to_glyphs_args: [
235
- [
236
- Cairo::ScaledFont, "text",
237
- Cairo::UserFontFace::TextToGlyphsData],
238
- ],
239
- unicode_to_glyph_args: [
240
- [Cairo::ScaledFont, codepoint("t")],
241
- [Cairo::ScaledFont, codepoint("e")],
242
- [Cairo::ScaledFont, codepoint("x")],
243
- [Cairo::ScaledFont, codepoint("t")],
244
- ],
245
- result: [
246
- [],
247
- [],
248
- Cairo::TextClusterFlag::BACKWARD,
249
- ],
250
- },
251
- {
252
- init_args: classify_cairo_object(face.init_args),
253
- render_glyph_args:
254
- classify_cairo_object(face.render_glyph_args),
255
- render_color_glyph_args:
256
- classify_cairo_object(face.render_color_glyph_args),
257
- text_to_glyphs_args:
258
- classify_cairo_object(face.text_to_glyphs_args),
259
- unicode_to_glyph_args:
260
- classify_cairo_object(face.unicode_to_glyph_args),
261
- result: result,
262
- })
264
+ expected[:render_color_glyph_args] = [
265
+ [Cairo::ScaledFont, codepoint("a"), Cairo::Context, Cairo::TextExtents],
266
+ [Cairo::ScaledFont, codepoint("b"), Cairo::Context, Cairo::TextExtents],
267
+ [Cairo::ScaledFont, codepoint("c"), Cairo::Context, Cairo::TextExtents],
268
+ ]
269
+ actual[:render_color_glyph_args] =
270
+ classify_cairo_object(face.render_color_glyph_args)
271
+ expected[:render_glyph_args] = []
272
+ actual[:render_glyph_args] =
273
+ classify_cairo_object(face.render_glyph_args)
263
274
  else
264
- assert_equal({
265
- init_args: [
266
- [Cairo::ScaledFont, Cairo::Context, Cairo::FontExtents]
267
- ],
268
- render_glyph_args: [
269
- [
270
- Cairo::ScaledFont, codepoint("t"),
271
- Cairo::Context, Cairo::TextExtents,
272
- ],
273
- [
274
- Cairo::ScaledFont, codepoint("e"),
275
- Cairo::Context, Cairo::TextExtents,
276
- ],
277
- [
278
- Cairo::ScaledFont, codepoint("x"),
279
- Cairo::Context, Cairo::TextExtents,
280
- ],
281
- ],
282
- text_to_glyphs_args: [
283
- [
284
- Cairo::ScaledFont, "text",
285
- Cairo::UserFontFace::TextToGlyphsData],
286
- ],
287
- unicode_to_glyph_args: [
288
- [Cairo::ScaledFont, codepoint("t")],
289
- [Cairo::ScaledFont, codepoint("e")],
290
- [Cairo::ScaledFont, codepoint("x")],
291
- [Cairo::ScaledFont, codepoint("t")],
292
- ],
293
- result: [
294
- [],
295
- [],
296
- Cairo::TextClusterFlag::BACKWARD,
297
- ],
298
- },
299
- {
300
- init_args: classify_cairo_object(face.init_args),
301
- render_glyph_args:
302
- classify_cairo_object(face.render_glyph_args),
303
- text_to_glyphs_args:
304
- classify_cairo_object(face.text_to_glyphs_args),
305
- unicode_to_glyph_args:
306
- classify_cairo_object(face.unicode_to_glyph_args),
307
- result: result,
308
- })
275
+ expected[:render_glyph_args] = [
276
+ [Cairo::ScaledFont, codepoint("a"), Cairo::Context, Cairo::TextExtents],
277
+ [Cairo::ScaledFont, codepoint("b"), Cairo::Context, Cairo::TextExtents],
278
+ [Cairo::ScaledFont, codepoint("c"), Cairo::Context, Cairo::TextExtents],
279
+ ]
280
+ actual[:render_glyph_args] =
281
+ classify_cairo_object(face.render_glyph_args)
309
282
  end
283
+ assert_equal(expected, actual)
310
284
  end
311
285
 
312
286
  def test_user_font_face_class_and_callback
@@ -324,6 +298,13 @@ class FontFaceTest < Test::Unit::TestCase
324
298
  render_glyph_args << args
325
299
  end
326
300
 
301
+ render_color_glyph_args = []
302
+ if face.respond_to?(:on_render_color_glyph)
303
+ face.on_render_color_glyph do |*args|
304
+ render_color_glyph_args << args
305
+ end
306
+ end
307
+
327
308
  text_to_glyphs_args = []
328
309
  face.on_text_to_glyphs do |*args|
329
310
  text_to_glyphs_args << args
@@ -342,34 +323,63 @@ class FontFaceTest < Test::Unit::TestCase
342
323
  Cairo::Matrix.identity,
343
324
  Cairo::Matrix.identity,
344
325
  Cairo::FontOptions.new)
345
- result = scaled_font.text_to_glyphs(0, 0, "text")
346
- assert_equal([[[Cairo::ScaledFont, Cairo::Context, Cairo::FontExtents]],
347
- [[Cairo::ScaledFont, codepoint("t"),
348
- Cairo::Context, Cairo::TextExtents],
349
- [Cairo::ScaledFont, codepoint("e"),
350
- Cairo::Context, Cairo::TextExtents],
351
- [Cairo::ScaledFont, codepoint("x"),
352
- Cairo::Context, Cairo::TextExtents]],
353
- [[Cairo::ScaledFont, "text",
354
- Cairo::UserFontFace::TextToGlyphsData]],
355
- [[Cairo::ScaledFont, codepoint("t")],
356
- [Cairo::ScaledFont, codepoint("e")],
357
- [Cairo::ScaledFont, codepoint("x")],
358
- [Cairo::ScaledFont, codepoint("t")]],
359
- [],
360
- [],
361
- [],
362
- [],
363
- [[], [], Cairo::TextClusterFlag::BACKWARD]],
364
- [classify_cairo_object(init_args),
365
- classify_cairo_object(render_glyph_args),
366
- classify_cairo_object(text_to_glyphs_args),
367
- classify_cairo_object(unicode_to_glyph_args),
368
- classify_cairo_object(face.init_args),
369
- classify_cairo_object(face.render_glyph_args),
370
- classify_cairo_object(face.text_to_glyphs_args),
371
- classify_cairo_object(face.unicode_to_glyph_args),
372
- result])
326
+ result = scaled_font.text_to_glyphs(0, 0, "abc")
327
+ expected = {
328
+ callback_init_args: [
329
+ [
330
+ Cairo::ScaledFont, Cairo::Context, Cairo::FontExtents,
331
+ ],
332
+ ],
333
+ callback_render_glyph_args: [
334
+ [Cairo::ScaledFont, codepoint("a"), Cairo::Context, Cairo::TextExtents],
335
+ [Cairo::ScaledFont, codepoint("b"), Cairo::Context, Cairo::TextExtents],
336
+ [Cairo::ScaledFont, codepoint("c"), Cairo::Context, Cairo::TextExtents],
337
+ ],
338
+ callback_render_color_glyph_args: [],
339
+ callback_text_to_glyphs_args: [
340
+ [Cairo::ScaledFont, "abc", Cairo::UserFontFace::TextToGlyphsData],
341
+ ],
342
+ callback_unicode_to_glyph_args: [
343
+ [Cairo::ScaledFont, codepoint("a")],
344
+ [Cairo::ScaledFont, codepoint("b")],
345
+ [Cairo::ScaledFont, codepoint("c")],
346
+ ],
347
+ object_init_args: [],
348
+ object_render_glyph_args: [],
349
+ object_render_color_glyph_args: [],
350
+ object_text_to_glyphs_args: [],
351
+ object_unicode_to_glyph_args: [],
352
+ result: [[], [], Cairo::TextClusterFlag::BACKWARD],
353
+ }
354
+ actual = {
355
+ callback_init_args: classify_cairo_object(init_args),
356
+ callback_render_glyph_args:
357
+ classify_cairo_object(render_glyph_args),
358
+ callback_render_color_glyph_args:
359
+ classify_cairo_object(render_color_glyph_args),
360
+ callback_text_to_glyphs_args:
361
+ classify_cairo_object(text_to_glyphs_args),
362
+ callback_unicode_to_glyph_args:
363
+ classify_cairo_object(unicode_to_glyph_args),
364
+ object_init_args:
365
+ classify_cairo_object(face.init_args),
366
+ object_render_glyph_args:
367
+ classify_cairo_object(face.render_glyph_args),
368
+ object_render_color_glyph_args:
369
+ classify_cairo_object(face.render_color_glyph_args),
370
+ object_text_to_glyphs_args:
371
+ classify_cairo_object(face.text_to_glyphs_args),
372
+ object_unicode_to_glyph_args:
373
+ classify_cairo_object(face.unicode_to_glyph_args),
374
+ result: result,
375
+ }
376
+ if Cairo.satisfied_version?(1, 17, 6)
377
+ expected[:callback_render_glyph_args],
378
+ expected[:callback_render_color_glyph_args] =
379
+ expected[:callback_render_color_glyph_args],
380
+ expected[:callback_render_glyph_args]
381
+ end
382
+ assert_equal(expected, actual)
373
383
  end
374
384
 
375
385
  def classify_cairo_object(object)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cairo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.17.6
4
+ version: 1.17.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-30 00:00:00.000000000 Z
11
+ date: 2022-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: native-package-installer