@flighthq/scene2d-formats 0.3.0 → 0.3.1-next.209.43ef1bc
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.
- package/dist/lottieDocument.d.ts.map +1 -1
- package/dist/lottieDocument.js +244 -34
- package/dist/lottieDocument.js.map +1 -1
- package/dist/svgDocument.js +15 -10
- package/dist/svgDocument.js.map +1 -1
- package/package.json +21 -21
- package/src/lottieDocumentConformance.test.ts +205 -6
- package/src/svgDocumentConformance.test.ts +34 -0
|
@@ -386,6 +386,40 @@ describe('SVG conformance matrix', () => {
|
|
|
386
386
|
expect(text.data.textFormatRanges[0].format.color).toBe(0x0000ffff);
|
|
387
387
|
});
|
|
388
388
|
|
|
389
|
+
it('keeps fill-none text transparent while a painted tspan remains visible', () => {
|
|
390
|
+
const root = createScene2DFromSvgDocument('<svg><text fill="none">A<tspan fill="red">B</tspan></text></svg>');
|
|
391
|
+
const text = getNodeChildAt(root, 0) as RichText;
|
|
392
|
+
|
|
393
|
+
expect(text.data.text).toBe('AB');
|
|
394
|
+
expect(text.data.textFormat.color).toBe(0x00000000);
|
|
395
|
+
expect(text.data.textFormatRanges[0].format.color).toBe(0xff0000ff);
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
it('omits hidden tspan content while permitting a visible descendant override', () => {
|
|
399
|
+
const root = createScene2DFromSvgDocument(
|
|
400
|
+
'<svg><text>A<tspan visibility="hidden">B<tspan visibility="visible">C</tspan></tspan>' +
|
|
401
|
+
'<tspan display="none">D<tspan display="inline">E</tspan></tspan>F</text></svg>',
|
|
402
|
+
);
|
|
403
|
+
const text = getNodeChildAt(root, 0) as RichText;
|
|
404
|
+
|
|
405
|
+
expect(text.data.text).toBe('ACF');
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
it('composes nested tspan opacity without applying the text opacity twice', () => {
|
|
409
|
+
const root = createScene2DFromSvgDocument(
|
|
410
|
+
'<svg><text opacity=".8">A<tspan opacity=".5">B<tspan opacity=".5">C</tspan></tspan></text></svg>',
|
|
411
|
+
);
|
|
412
|
+
const text = getNodeChildAt(root, 0) as RichText;
|
|
413
|
+
|
|
414
|
+
expect(text.data.text).toBe('ABC');
|
|
415
|
+
expect(text.alpha).toBeCloseTo(0.8);
|
|
416
|
+
expect(text.data.textFormat.color).toBe(0x000000ff);
|
|
417
|
+
expect(text.data.textFormatRanges).toEqual([
|
|
418
|
+
expect.objectContaining({ end: 2, format: expect.objectContaining({ color: 0x00000080 }), start: 1 }),
|
|
419
|
+
expect.objectContaining({ end: 3, format: expect.objectContaining({ color: 0x00000040 }), start: 2 }),
|
|
420
|
+
]);
|
|
421
|
+
});
|
|
422
|
+
|
|
389
423
|
it('suppresses display none while allowing visibility descendants to override', () => {
|
|
390
424
|
const root = createScene2DFromSvgDocument(`
|
|
391
425
|
<svg>
|