RowTests.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788
  1. namespace QuestPDF.LayoutTests;
  2. [TestFixture]
  3. public class RowTests
  4. {
  5. #region General Item Positioning
  6. [Test]
  7. public void SingleConstantItem()
  8. {
  9. LayoutTest
  10. .HavingSpaceOfSize(100, 100)
  11. .ForContent(content =>
  12. {
  13. content.Shrink().Row(row =>
  14. {
  15. row.ConstantItem(40).Mock("a").Height(30);
  16. });
  17. })
  18. .ExpectDrawResult(document =>
  19. {
  20. document
  21. .Page()
  22. .RequiredAreaSize(40, 30)
  23. .Content(page =>
  24. {
  25. page.Mock("a").Position(0, 0).Size(40, 30);
  26. });
  27. });
  28. }
  29. [Test]
  30. public void MultipleConstantItems()
  31. {
  32. LayoutTest
  33. .HavingSpaceOfSize(100, 100)
  34. .ForContent(content =>
  35. {
  36. content.Shrink().Row(row =>
  37. {
  38. row.ConstantItem(20).Mock("a").Height(30);
  39. row.ConstantItem(30).Mock("b").Height(40);
  40. row.ConstantItem(40).Mock("c").Height(20);
  41. });
  42. })
  43. .ExpectDrawResult(document =>
  44. {
  45. document
  46. .Page()
  47. .RequiredAreaSize(90, 40)
  48. .Content(page =>
  49. {
  50. page.Mock("a").Position(0, 0).Size(20, 40);
  51. page.Mock("b").Position(20, 0).Size(30, 40);
  52. page.Mock("c").Position(50, 0).Size(40, 40);
  53. });
  54. });
  55. }
  56. [Test]
  57. public void SingleRelativeItem()
  58. {
  59. LayoutTest
  60. .HavingSpaceOfSize(100, 100)
  61. .ForContent(content =>
  62. {
  63. content.Shrink().Row(row =>
  64. {
  65. row.RelativeItem().Mock("a").Height(30);
  66. });
  67. })
  68. .ExpectDrawResult(document =>
  69. {
  70. document
  71. .Page()
  72. .RequiredAreaSize(100, 30)
  73. .Content(page =>
  74. {
  75. page.Mock("a").Position(0, 0).Size(100, 30);
  76. });
  77. });
  78. }
  79. [Test]
  80. public void TwoRelativeItems()
  81. {
  82. LayoutTest
  83. .HavingSpaceOfSize(100, 100)
  84. .ForContent(content =>
  85. {
  86. content.Shrink().Row(row =>
  87. {
  88. row.RelativeItem(2).Mock("a").Height(40);
  89. row.RelativeItem(3).Mock("b").Height(50);
  90. });
  91. })
  92. .ExpectDrawResult(document =>
  93. {
  94. document
  95. .Page()
  96. .RequiredAreaSize(100, 50)
  97. .Content(page =>
  98. {
  99. page.Mock("a").Position(0, 0).Size(40, 50);
  100. page.Mock("b").Position(40, 0).Size(60, 50);
  101. });
  102. });
  103. }
  104. [Test]
  105. public void SingleAutoItem()
  106. {
  107. LayoutTest
  108. .HavingSpaceOfSize(100, 100)
  109. .ForContent(content =>
  110. {
  111. content.Shrink().Row(row =>
  112. {
  113. row.AutoItem().Mock("a").Size(60, 40);
  114. });
  115. })
  116. .ExpectDrawResult(document =>
  117. {
  118. document
  119. .Page()
  120. .RequiredAreaSize(60, 40)
  121. .Content(page =>
  122. {
  123. page.Mock("a").Position(0, 0).Size(60, 40);
  124. });
  125. });
  126. }
  127. [Test]
  128. public void RelativeItemFillsRemainingSpace()
  129. {
  130. LayoutTest
  131. .HavingSpaceOfSize(100, 100)
  132. .ForContent(content =>
  133. {
  134. content.Shrink().Row(row =>
  135. {
  136. row.ConstantItem(20).Mock("a").Height(30);
  137. row.ConstantItem(30).Mock("b").Height(50);
  138. row.RelativeItem().Mock("c").Height(40);
  139. });
  140. })
  141. .ExpectDrawResult(document =>
  142. {
  143. document
  144. .Page()
  145. .RequiredAreaSize(100, 50)
  146. .Content(page =>
  147. {
  148. page.Mock("a").Position(0, 0).Size(20, 50);
  149. page.Mock("b").Position(20, 0).Size(30, 50);
  150. page.Mock("c").Position(50, 0).Size(50, 50);
  151. });
  152. });
  153. }
  154. [Test]
  155. public void RelativeItemsSplitRemainingSpaceAccordingToProportions()
  156. {
  157. LayoutTest
  158. .HavingSpaceOfSize(100, 100)
  159. .ForContent(content =>
  160. {
  161. content.Shrink().Row(row =>
  162. {
  163. row.ConstantItem(30).Mock("a").Height(60);
  164. row.RelativeItem(4).Mock("b").Height(40);
  165. row.RelativeItem(3).Mock("c").Height(30);
  166. });
  167. })
  168. .ExpectDrawResult(document =>
  169. {
  170. document
  171. .Page()
  172. .RequiredAreaSize(100, 60)
  173. .Content(page =>
  174. {
  175. page.Mock("a").Position(0, 0).Size(30, 60);
  176. page.Mock("b").Position(30, 0).Size(40, 60);
  177. page.Mock("c").Position(70, 0).Size(30, 60);
  178. });
  179. });
  180. }
  181. [Test]
  182. public void ComplexItems()
  183. {
  184. LayoutTest
  185. .HavingSpaceOfSize(200, 100)
  186. .ForContent(content =>
  187. {
  188. content.Shrink().Row(row =>
  189. {
  190. row.ConstantItem(30).Mock("a").Height(60);
  191. row.RelativeItem(1).Mock("b").Height(40);
  192. row.RelativeItem(2).Mock("c").Height(30);
  193. row.ConstantItem(20).Mock("d").Height(30);
  194. row.RelativeItem(3).Mock("e").Height(20);
  195. row.RelativeItem(2).Mock("f").Height(70);
  196. row.AutoItem().Mock("g").Size(40, 50);
  197. row.AutoItem().Mock("h").Size(30, 40);
  198. });
  199. })
  200. .ExpectDrawResult(document =>
  201. {
  202. document
  203. .Page()
  204. .RequiredAreaSize(200, 70)
  205. .Content(page =>
  206. {
  207. page.Mock("a").Position(0, 0).Size(30, 70);
  208. page.Mock("b").Position(30, 0).Size(10, 70);
  209. page.Mock("c").Position(40, 0).Size(20, 70);
  210. page.Mock("d").Position(60, 0).Size(20, 70);
  211. page.Mock("e").Position(80, 0).Size(30, 70);
  212. page.Mock("f").Position(110, 0).Size(20, 70);
  213. page.Mock("g").Position(130, 0).Size(40, 70);
  214. page.Mock("h").Position(170, 0).Size(30, 70);
  215. });
  216. });
  217. }
  218. #endregion
  219. #region Drawing On Multiple Pages
  220. [Test]
  221. public void OneItemSpansTwoPages()
  222. {
  223. LayoutTest
  224. .HavingSpaceOfSize(80, 100)
  225. .ForContent(content =>
  226. {
  227. content.Shrink().Row(row =>
  228. {
  229. row.RelativeItem().Mock("a").SolidBlock(height: 40);
  230. row.RelativeItem().Mock("b").SolidBlock(height: 80);
  231. row.RelativeItem(2).Mock("c").ContinuousBlock(20, 140);
  232. });
  233. })
  234. .ExpectDrawResult(document =>
  235. {
  236. document
  237. .Page()
  238. .RequiredAreaSize(80, 100)
  239. .Content(page =>
  240. {
  241. page.Mock("a").Position(0, 0).Size(20, 100);
  242. page.Mock("b").Position(20, 0).Size(20, 100);
  243. page.Mock("c").Position(40, 0).Size(40, 100);
  244. });
  245. document
  246. .Page()
  247. .RequiredAreaSize(80, 40)
  248. .Content(page =>
  249. {
  250. page.Mock("a").Position(0, 0).Size(20, 40);
  251. page.Mock("b").Position(20, 0).Size(20, 40);
  252. page.Mock("c").Position(40, 0).Size(40, 40);
  253. });
  254. });
  255. }
  256. #endregion
  257. #region Spacing
  258. [Test]
  259. public void NoSpacing()
  260. {
  261. LayoutTest
  262. .HavingSpaceOfSize(100, 100)
  263. .ForContent(content =>
  264. {
  265. content.Shrink().Row(row =>
  266. {
  267. row.ConstantItem(10).Mock("a").SolidBlock(height: 40);
  268. row.ConstantItem(20).Mock("b").SolidBlock(height: 50);
  269. row.ConstantItem(30).Mock("c").SolidBlock(height: 30);
  270. });
  271. })
  272. .ExpectDrawResult(document =>
  273. {
  274. document
  275. .Page()
  276. .RequiredAreaSize(60, 50)
  277. .Content(page =>
  278. {
  279. page.Mock("a").Position(0, 0).Size(10, 50);
  280. page.Mock("b").Position(10, 0).Size(20, 50);
  281. page.Mock("c").Position(30, 0).Size(30, 50);
  282. });
  283. });
  284. }
  285. [Test]
  286. public void NormalSpacing()
  287. {
  288. LayoutTest
  289. .HavingSpaceOfSize(100, 100)
  290. .ForContent(content =>
  291. {
  292. content.Shrink().Row(row =>
  293. {
  294. row.Spacing(10);
  295. row.ConstantItem(10).Mock("a").SolidBlock(height: 40);
  296. row.ConstantItem(20).Mock("b").SolidBlock(height: 50);
  297. row.ConstantItem(30).Mock("c").SolidBlock(height: 30);
  298. });
  299. })
  300. .ExpectDrawResult(document =>
  301. {
  302. document
  303. .Page()
  304. .RequiredAreaSize(80, 50)
  305. .Content(page =>
  306. {
  307. page.Mock("a").Position(0, 0).Size(10, 50);
  308. page.Mock("b").Position(20, 0).Size(20, 50);
  309. page.Mock("c").Position(50, 0).Size(30, 50);
  310. });
  311. });
  312. }
  313. [Test]
  314. public void BiggerSpacing()
  315. {
  316. LayoutTest
  317. .HavingSpaceOfSize(100, 100)
  318. .ForContent(content =>
  319. {
  320. content.Shrink().Row(row =>
  321. {
  322. row.Spacing(15);
  323. row.ConstantItem(10).Mock("a").SolidBlock(height: 40);
  324. row.ConstantItem(20).Mock("b").SolidBlock(height: 50);
  325. row.ConstantItem(30).Mock("c").SolidBlock(height: 30);
  326. });
  327. })
  328. .ExpectDrawResult(document =>
  329. {
  330. document
  331. .Page()
  332. .RequiredAreaSize(90, 50)
  333. .Content(page =>
  334. {
  335. page.Mock("a").Position(0, 0).Size(10, 50);
  336. page.Mock("b").Position(25, 0).Size(20, 50);
  337. page.Mock("c").Position(60, 0).Size(30, 50);
  338. });
  339. });
  340. }
  341. [Test]
  342. public void SpacingDoesNotFitInAvailableSpace()
  343. {
  344. LayoutTest
  345. .HavingSpaceOfSize(100, 100)
  346. .ForContent(content =>
  347. {
  348. content.Shrink().Row(row =>
  349. {
  350. row.Spacing(20);
  351. row.ConstantItem(30).Height(50);
  352. row.ConstantItem(30).Height(50);
  353. row.ConstantItem(30).Height(50);
  354. });
  355. })
  356. .ExpectLayoutException("The content requires more horizontal space than available.");
  357. }
  358. [Test]
  359. public void SpacingIsLargerThanAvailableSpace()
  360. {
  361. LayoutTest
  362. .HavingSpaceOfSize(100, 100)
  363. .ForContent(content =>
  364. {
  365. content.Shrink().Row(row =>
  366. {
  367. row.Spacing(200);
  368. row.ConstantItem(10).SolidBlock(height: 40); // <-
  369. });
  370. })
  371. .ExpectLayoutException("The content requires more horizontal space than available.");
  372. }
  373. [Test]
  374. public void NotEnoughSpaceForRelativeItemsAfterApplyingSpacing()
  375. {
  376. LayoutTest
  377. .HavingSpaceOfSize(100, 100)
  378. .ForContent(content =>
  379. {
  380. content.Shrink().Row(row =>
  381. {
  382. row.Spacing(20);
  383. row.ConstantItem(40);
  384. row.ConstantItem(40);
  385. row.RelativeItem();
  386. });
  387. })
  388. .ExpectLayoutException("One of the items has a negative size, indicating insufficient horizontal space. Usually, constant items require more space than is available, potentially causing other content to overflow.");
  389. }
  390. #endregion
  391. #region Paging
  392. [Test]
  393. public void OneItemRequiresTwoPages()
  394. {
  395. LayoutTest
  396. .HavingSpaceOfSize(100, 100)
  397. .ForContent(content =>
  398. {
  399. content.Shrink().Row(row =>
  400. {
  401. row.RelativeItem(2).Mock("a").Height(30);
  402. row.RelativeItem(3).Mock("b").ContinuousBlock(height: 140);
  403. });
  404. })
  405. .ExpectDrawResult(document =>
  406. {
  407. document
  408. .Page()
  409. .RequiredAreaSize(100, 100)
  410. .Content(page =>
  411. {
  412. page.Mock("a").Position(0, 0).Size(40, 100);
  413. page.Mock("b").Position(40, 0).Size(60, 100);
  414. });
  415. document
  416. .Page()
  417. .RequiredAreaSize(100, 40)
  418. .Content(page =>
  419. {
  420. page.Mock("a").Position(0, 0).Size(40, 40);
  421. page.Mock("b").Position(40, 0).Size(60, 40);
  422. });
  423. });
  424. }
  425. [Test]
  426. public void ItemsRequireMultiplePages()
  427. {
  428. LayoutTest
  429. .HavingSpaceOfSize(100, 100)
  430. .ForContent(content =>
  431. {
  432. content.Shrink().Row(row =>
  433. {
  434. row.RelativeItem(2).Mock("a").ContinuousBlock(height: 230);
  435. row.RelativeItem(3).Mock("b").ContinuousBlock(height: 140);
  436. });
  437. })
  438. .ExpectDrawResult(document =>
  439. {
  440. document
  441. .Page()
  442. .RequiredAreaSize(100, 100)
  443. .Content(page =>
  444. {
  445. page.Mock("a").Position(0, 0).Size(40, 100);
  446. page.Mock("b").Position(40, 0).Size(60, 100);
  447. });
  448. document
  449. .Page()
  450. .RequiredAreaSize(100, 100)
  451. .Content(page =>
  452. {
  453. page.Mock("a").Position(0, 0).Size(40, 100);
  454. page.Mock("b").Position(40, 0).Size(60, 100);
  455. });
  456. document
  457. .Page()
  458. .RequiredAreaSize(100, 30)
  459. .Content(page =>
  460. {
  461. page.Mock("a").Position(0, 0).Size(40, 30);
  462. page.Mock("b").Position(40, 0).Size(60, 30);
  463. });
  464. });
  465. }
  466. [Test]
  467. public void ItemHeightExceedsAvailableHeight()
  468. {
  469. LayoutTest
  470. .HavingSpaceOfSize(100, 100)
  471. .ForContent(content =>
  472. {
  473. content.Shrink().Row(row =>
  474. {
  475. row.ConstantItem(40).Height(50);
  476. row.ConstantItem(40).Height(200); // <-
  477. });
  478. })
  479. .ExpectLayoutException("The available vertical space is less than the minimum height.");
  480. }
  481. #endregion
  482. #region Right-To-Left Direction
  483. [Test]
  484. public void RightToLeftDirection()
  485. {
  486. LayoutTest
  487. .HavingSpaceOfSize(100, 100)
  488. .ForContent(content =>
  489. {
  490. content.ContentFromRightToLeft().Shrink().Row(row =>
  491. {
  492. row.ConstantItem(20).Mock("a").Height(30);
  493. row.ConstantItem(30).Mock("b").Height(40);
  494. row.ConstantItem(40).Mock("c").Height(20);
  495. });
  496. })
  497. .ExpectDrawResult(document =>
  498. {
  499. document
  500. .Page()
  501. .RequiredAreaSize(90, 40)
  502. .Content(page =>
  503. {
  504. page.Mock("a").Position(80, 0).Size(20, 40);
  505. page.Mock("b").Position(50, 0).Size(30, 40);
  506. page.Mock("c").Position(10, 0).Size(40, 40);
  507. });
  508. });
  509. }
  510. #endregion
  511. #region Layout Exceptions
  512. [Test]
  513. public void ConstantItemOfTooLargeSize()
  514. {
  515. LayoutTest
  516. .HavingSpaceOfSize(100, 100)
  517. .ForContent(content =>
  518. {
  519. content.Shrink().Row(row =>
  520. {
  521. row.ConstantItem(200); // <-
  522. });
  523. })
  524. .ExpectLayoutException("The content requires more horizontal space than available.");
  525. }
  526. [Test]
  527. public void ConstantItemHasChildOfTooLargeSize()
  528. {
  529. LayoutTest
  530. .HavingSpaceOfSize(100, 100)
  531. .ForContent(content =>
  532. {
  533. content.Shrink().Row(row =>
  534. {
  535. row.ConstantItem(30).Width(20);
  536. row.ConstantItem(40).Width(200); // <-
  537. });
  538. })
  539. .ExpectLayoutException("The available horizontal space is less than the minimum width.");
  540. }
  541. [Test]
  542. public void SumOfConstantItemsExceedsAvailableWidth()
  543. {
  544. LayoutTest
  545. .HavingSpaceOfSize(100, 100)
  546. .ForContent(content =>
  547. {
  548. content.Shrink().Row(row =>
  549. {
  550. row.ConstantItem(40);
  551. row.ConstantItem(40);
  552. row.ConstantItem(40);
  553. });
  554. })
  555. .ExpectLayoutException("The content requires more horizontal space than available.");
  556. }
  557. [Test]
  558. public void RelativeItemHasChildOfTooLargeSize()
  559. {
  560. LayoutTest
  561. .HavingSpaceOfSize(100, 100)
  562. .ForContent(content =>
  563. {
  564. content.Shrink().Row(row =>
  565. {
  566. row.RelativeItem(2).Width(30);
  567. row.RelativeItem(3).Width(200); // <-
  568. });
  569. })
  570. .ExpectLayoutException("The available horizontal space is less than the minimum width.");
  571. }
  572. [Test]
  573. public void AutoItemHasChildOfTooLargeSize()
  574. {
  575. LayoutTest
  576. .HavingSpaceOfSize(100, 100)
  577. .ForContent(content =>
  578. {
  579. content.Shrink().Row(row =>
  580. {
  581. row.ConstantItem(30);
  582. row.AutoItem().Width(80);
  583. });
  584. })
  585. .ExpectLayoutException("The content requires more horizontal space than available.");
  586. }
  587. [Test]
  588. public void SumOfAutoItemsExceedsAvailableWidth()
  589. {
  590. LayoutTest
  591. .HavingSpaceOfSize(100, 100)
  592. .ForContent(content =>
  593. {
  594. content.Shrink().Row(row =>
  595. {
  596. row.AutoItem().Width(30);
  597. row.AutoItem().Width(40);
  598. row.AutoItem().Width(50);
  599. });
  600. })
  601. .ExpectLayoutException("The content requires more horizontal space than available.");
  602. }
  603. [Test]
  604. public void SumOfVariousItemsExceedsAvailableWidth()
  605. {
  606. LayoutTest
  607. .HavingSpaceOfSize(100, 100)
  608. .ForContent(content =>
  609. {
  610. content.Shrink().Row(row =>
  611. {
  612. row.ConstantItem(60);
  613. row.AutoItem().Width(50);
  614. });
  615. })
  616. .ExpectLayoutException("The content requires more horizontal space than available.");
  617. }
  618. #endregion
  619. #region Corner Cases
  620. [Test]
  621. public void NoItems()
  622. {
  623. LayoutTest
  624. .HavingSpaceOfSize(100, 100)
  625. .ForContent(content =>
  626. {
  627. content.Shrink().Row(row =>
  628. {
  629. // <-
  630. });
  631. })
  632. .ExpectDrawResult(document =>
  633. {
  634. document
  635. .Page()
  636. .RequiredAreaSize(0, 0)
  637. .Content(page => { });
  638. });
  639. }
  640. [Test]
  641. public void RerenderingOfFullyDrawnRow()
  642. {
  643. LayoutTest
  644. .HavingSpaceOfSize(100, 100)
  645. .ForContent(content =>
  646. {
  647. content.Shrink().Row(row =>
  648. {
  649. row.RelativeItem().Mock("a").Row(innerRow =>
  650. {
  651. innerRow.RelativeItem().Mock("b").SolidBlock(20, 50);
  652. innerRow.RelativeItem().Mock("c").SolidBlock(15, 40);
  653. });
  654. row.RelativeItem().Mock("d").ContinuousBlock(40, 140);
  655. });
  656. })
  657. .ExpectDrawResult(document =>
  658. {
  659. document
  660. .Page()
  661. .RequiredAreaSize(100, 100)
  662. .Content(page =>
  663. {
  664. page.Mock("a").Position(0, 0).Size(50, 100);
  665. page.Mock("b").Position(0, 0).Size(25, 100);
  666. page.Mock("c").Position(25, 0).Size(25, 100);
  667. page.Mock("d").Position(50, 0).Size(50, 100);
  668. });
  669. document
  670. .Page()
  671. .RequiredAreaSize(100, 40)
  672. .Content(page =>
  673. {
  674. page.Mock("a").Position(0, 0).Size(50, 40);
  675. page.Mock("d").Position(50, 0).Size(50, 40);
  676. });
  677. });
  678. }
  679. #endregion
  680. #region Stateful
  681. [Test]
  682. public void CheckRenderingState()
  683. {
  684. LayoutTest
  685. .HavingSpaceOfSize(240, 100)
  686. .ForContent(content =>
  687. {
  688. content.Shrink().Mock("a").Row(innerRow =>
  689. {
  690. innerRow.RelativeItem().ContinuousBlock(50, 80);
  691. innerRow.RelativeItem().ContinuousBlock(50, 250);
  692. innerRow.RelativeItem().ContinuousBlock(50, 170);
  693. innerRow.RelativeItem().ContinuousBlock(50, 320);
  694. });
  695. })
  696. .ExpectDrawResult(document =>
  697. {
  698. document
  699. .Page()
  700. .RequiredAreaSize(240, 100)
  701. .Content(page =>
  702. {
  703. page.Mock("a").Position(0, 0).Size(240, 100).State(new[] { true, false, false, false });
  704. });
  705. document
  706. .Page()
  707. .RequiredAreaSize(240, 100)
  708. .Content(page =>
  709. {
  710. page.Mock("a").Position(0, 0).Size(240, 100).State(new[] { true, false, true, false });
  711. });
  712. document
  713. .Page()
  714. .RequiredAreaSize(240, 100)
  715. .Content(page =>
  716. {
  717. page.Mock("a").Position(0, 0).Size(240, 100).State(new[] { true, true, true, false });
  718. });
  719. document
  720. .Page()
  721. .RequiredAreaSize(240, 20)
  722. .Content(page =>
  723. {
  724. page.Mock("a").Position(0, 0).Size(240, 20).State(new[] { true, true, true, true });
  725. });
  726. });
  727. }
  728. #endregion
  729. }