@@ -1215,6 +1215,85 @@ fn test_fixed_page_text_box_auto_fit_short_text_uses_scale_to_fit() {
12151215 ) ;
12161216}
12171217
1218+ #[ test]
1219+ fn test_fixed_page_text_box_no_wrap_auto_fit_uses_scale_to_fit ( ) {
1220+ let doc = make_doc ( vec ! [ make_fixed_page(
1221+ 960.0 ,
1222+ 540.0 ,
1223+ vec![ FixedElement {
1224+ x: 295.0 ,
1225+ y: 78.0 ,
1226+ width: 143.16 ,
1227+ height: 58.15 ,
1228+ kind: FixedElementKind :: TextBox ( crate :: ir:: TextBoxData {
1229+ content: vec![ Block :: Paragraph ( Paragraph {
1230+ style: ParagraphStyle :: default ( ) ,
1231+ runs: vec![
1232+ Run {
1233+ text: "- " . to_string( ) ,
1234+ style: TextStyle {
1235+ font_size: Some ( 41.99 ) ,
1236+ ..TextStyle :: default ( )
1237+ } ,
1238+ href: None ,
1239+ footnote: None ,
1240+ } ,
1241+ Run {
1242+ text: "목 차 " . to_string( ) ,
1243+ style: TextStyle {
1244+ font_size: Some ( 41.99 ) ,
1245+ ..TextStyle :: default ( )
1246+ } ,
1247+ href: None ,
1248+ footnote: None ,
1249+ } ,
1250+ Run {
1251+ text: "-" . to_string( ) ,
1252+ style: TextStyle {
1253+ font_size: Some ( 41.99 ) ,
1254+ ..TextStyle :: default ( )
1255+ } ,
1256+ href: None ,
1257+ footnote: None ,
1258+ } ,
1259+ ] ,
1260+ } ) ] ,
1261+ padding: Insets :: default ( ) ,
1262+ vertical_align: crate :: ir:: TextBoxVerticalAlign :: Top ,
1263+ fill: None ,
1264+ opacity: None ,
1265+ stroke: None ,
1266+ shape_kind: None ,
1267+ no_wrap: true ,
1268+ auto_fit: true ,
1269+ } ) ,
1270+ } ] ,
1271+ ) ] ) ;
1272+ let output = generate_typst ( & doc) . unwrap ( ) ;
1273+ assert ! (
1274+ output. source. contains( "#let text_box_raw_0 = [" ) ,
1275+ "Expected no-wrap auto-fit title to use raw single-line measurement, got:\n {}" ,
1276+ output. source,
1277+ ) ;
1278+ assert ! (
1279+ output. source. contains( "let text_box_scale_width_0 =" ) ,
1280+ "Expected no-wrap auto-fit title to compute width scale, got:\n {}" ,
1281+ output. source,
1282+ ) ;
1283+ assert ! (
1284+ output. source. contains( "let text_box_scale_height_0 =" ) ,
1285+ "Expected no-wrap auto-fit title to compute height scale, got:\n {}" ,
1286+ output. source,
1287+ ) ;
1288+ assert ! (
1289+ output. source. contains(
1290+ "#scale(x: text_box_scale_0, y: text_box_scale_0, origin: top + left, reflow: true)["
1291+ ) ,
1292+ "Expected no-wrap auto-fit title to use scale-to-fit, got:\n {}" ,
1293+ output. source,
1294+ ) ;
1295+ }
1296+
12181297#[ test]
12191298fn test_fixed_page_text_box_mixed_font_header_uses_scale_to_fit ( ) {
12201299 let doc = make_doc ( vec ! [ make_fixed_page(
0 commit comments