Skip to content

Commit bf692d8

Browse files
committed
Update test
1 parent 0444364 commit bf692d8

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed
21.7 KB
Loading

package/src/renderer/__tests__/e2e/Paragraphs.spec.tsx

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -502,26 +502,20 @@ describe("Paragraphs", () => {
502502
)!;
503503
const provider = Skia.TypefaceFontProvider.Make();
504504
provider.registerFont(robotoRegular, "Roboto");
505-
const para = Skia.ParagraphBuilder.Make(
506-
{
507-
textStyle: {
508-
fontFamilies: ["Roboto"],
509-
color: Skia.Color("black"),
510-
fontSize: 30,
511-
},
512-
},
513-
provider
514-
)
505+
const para = Skia.ParagraphBuilder.Make({}, provider)
506+
.pushStyle({
507+
fontFamilies: ["Roboto"],
508+
color: Skia.Color("black"),
509+
fontSize: 30,
510+
})
515511
.addText("Say Hello to React Native Skia")
512+
.pop()
516513
.build();
517514
para.layout(150);
518515
const paint = Skia.Paint();
519516
paint.setColor(Skia.Color("cyan"));
520-
const maxWidth = para.getMaxWidth();
521517
const height = para.getHeight();
522-
const longestLine = para.getLongestLine();
523-
// The width of the bounding box is the smaller of the maximum width or the maximum intrinsic width
524-
const width = Math.min(maxWidth, longestLine);
518+
const width = para.getLongestLine();
525519
canvas.drawRect(Skia.XYWHRect(0, 0, width, height), paint);
526520
para.paint(canvas, 0, 0);
527521
},

0 commit comments

Comments
 (0)