27float.t 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531
  1. use strict;
  2. use File::Spec;
  3. BEGIN { if (defined($ENV{'top_srcdir'})) {unshift @INC, File::Spec->catdir($ENV{'top_srcdir'}, 'tp');} }
  4. require 't/test_utils.pl';
  5. my @test_cases = (
  6. ['listoffloats_with_commands',
  7. '@listoffloats th@\'eor@`eme
  8. '],
  9. ['empty_listoffloats',
  10. '@listoffloats
  11. '],
  12. ['simple',
  13. '@float Type, Label
  14. In float.
  15. @caption{Caption.}
  16. @end float'],
  17. ['ref_to_float',
  18. '@float Text, Label1
  19. Float
  20. @end float
  21. @float , Label2
  22. In foat 2.
  23. @end float
  24. @ref{Label1}
  25. @ref{Label2}
  26. '],
  27. ['float_with_at_commands',
  28. '@float entr@\'ee, premi@`ere entr@\'ee
  29. Ceci est notre premi@`ere entr@\'ee.
  30. @caption{La premi@`ere entr@\'ee est importante}
  31. @end float
  32. @listoffloats entr@\'ee
  33. '],
  34. ['footnote_in_caption',
  35. '@node Top
  36. @listoffloats fl
  37. @float fl, label
  38. In float.
  39. @caption{in caption@footnote{in footnote}}
  40. @end float
  41. '],
  42. ['footnote_in_caption_and_error',
  43. '@node Top
  44. @listoffloats fl
  45. @float fl, label
  46. In float.
  47. @caption{in caption@footnote{in footnote @error}}
  48. @end float
  49. '],
  50. ['anchor_in_caption',
  51. '@node Top
  52. @listoffloats fl
  53. @float fl, label
  54. In float.
  55. @caption{in caption@anchor{in anchor}}
  56. @end float
  57. '],
  58. ['cindex_in_caption',
  59. '@node Top
  60. @listoffloats fl
  61. @float fl, label
  62. In float.
  63. @caption{in caption
  64. @cindex index entry
  65. }
  66. @end float
  67. @printindex cp
  68. '],
  69. ['complex_float',
  70. '@node Top
  71. @top Test floats
  72. A list of floats at the beginning.
  73. @listoffloats Text
  74. After the listoffloats.
  75. @menu
  76. * chapter::
  77. @end menu
  78. @float Text, text with a lot of features
  79. An example of float @enddots{}
  80. @c makeinfo --docbook segfaults
  81. @ifset texi2html
  82. An example.
  83. @example
  84. example
  85. @end example
  86. A multitable.
  87. @multitable {truc} {bidule}
  88. @item truc @tab bidule
  89. @item truc @tab bidule
  90. @end multitable
  91. @end ifset
  92. An index entry
  93. @cindex float example
  94. A table.
  95. @table @emph
  96. @item truc
  97. line
  98. @end table
  99. An itemize.
  100. @itemize @minus
  101. @item truc
  102. line
  103. @end itemize
  104. A ref.
  105. @xref{Top,xref Text with features}.
  106. A footnote.
  107. @footnote{footnote Text with features}.
  108. @TeX{} and @emph{@b{t@\'e@^{@dotless{i}}}@url{an_url}} @sc{and} @verb{!it is @verb!} @ a wo@-rd @!@@ @AE{}.
  109. @caption{ An example of float caption@enddots{}
  110. An example.
  111. @example
  112. example
  113. @end example
  114. @anchor{Anchor in caption}
  115. A table.
  116. @table @emph
  117. @item truc
  118. line
  119. @end table
  120. A multitable.
  121. @multitable {truc} {bidule}
  122. @item truc @tab bidule
  123. @item truc @tab bidule
  124. @end multitable
  125. An index entry
  126. @cindex float example in caption
  127. An itemize.
  128. @itemize @minus
  129. @item truc
  130. line
  131. @end itemize
  132. A ref.
  133. @xref{Top,xref Text with features caption}.
  134. A footnote.
  135. @footnote{footnote Text with features caption}.
  136. @TeX{} and @emph{@b{t@\'e@^{@dotless{i}}}@url{an_url}} @sc{and} @verb{!it is @verb!} @ a wo@-rd @!@@ @AE{}.
  137. }
  138. @shortcaption{@TeX{} and @emph{@b{t@\'e@^{@dotless{i}}}@url{an_url}} @sc{and} @verb{!it is @verb!} @ a wo@-rd @!@@ @AE{}.}
  139. @end float
  140. @node chapter
  141. @chapter A chapter
  142. @float Text, float with a lot of features and no shortcaption
  143. Float text of a float with a lot of features.
  144. @caption{ An example of float caption@enddots{} 2
  145. An example 2.
  146. @example
  147. example 2
  148. @end example
  149. A table 2.
  150. @table @emph
  151. @item truc 2
  152. line 2
  153. @end table
  154. A multitable 2.
  155. @multitable {truc} {bidule}
  156. @item truc 2 @tab bidule
  157. @item truc 2 @tab bidule
  158. @end multitable
  159. An index entry 2
  160. @cindex float example in caption 2
  161. An itemize 2.
  162. @itemize @minus
  163. @item truc 2
  164. line
  165. @end itemize
  166. @anchor{Anchor in caption 2}
  167. A ref 2.
  168. @xref{Top,xref Text with features caption}.
  169. A footnote 2.
  170. @footnote{footnote Text with features caption 2}.
  171. @TeX{} and @emph{@b{t@\'e@^{@dotless{i}}}@url{an_url}} @sc{and} @verb{!it is @verb!} @ a wo@-rd @!@@ @AE{}.
  172. }
  173. @end float
  174. @xref{text with a lot of features}.
  175. '],
  176. ['numbering_captions_listoffloats',
  177. '@node Top
  178. @top Test floats
  179. @float Text, text with a lot of features
  180. @caption{ An example of float caption@enddots{}}
  181. @shortcaption{@TeX{} and someething}
  182. @end float
  183. @float Text
  184. No label but caption and shortcaption.
  185. @caption{C No label}
  186. @shortcaption{SC No label}
  187. @end float
  188. @float ,label but no type
  189. No type but caption and shortcaption.
  190. @caption{C No type}
  191. @shortcaption{SC No type}
  192. @end float
  193. @float ,label but no type and no caption
  194. No type but label and no caption nor shortcaption.
  195. @end float
  196. @float
  197. No label, no type, no caption no shortcaption.
  198. @end float
  199. @float
  200. No label, no type, but caption and shortcaption.
  201. @caption{C No label, no type, but caption and shortcaption.}
  202. @shortcaption{SC No label, no type, but caption and shortcaption.}
  203. @end float
  204. @float ,label but no type 2
  205. Second float with no type.
  206. @caption{C No type 2}
  207. @shortcaption{SC No type 2}
  208. @end float
  209. @float Warning, warning in top
  210. A warning
  211. @caption{C A warning}
  212. @shortcaption{SC A warning}
  213. @end float
  214. @menu
  215. * chapter::
  216. * Unnumbered::
  217. * Chapter with unnumbsubsec::
  218. * Appendix for float::
  219. * list of floats::
  220. @end menu
  221. @node chapter
  222. @chapter A chapter
  223. @float Text, text in chapter
  224. Text in chapter
  225. @caption{C Text in chapter}
  226. @end float
  227. @float Text, float with a lot of features and no shortcaption
  228. @caption{ An example of float caption, no shortcaption@enddots{}}
  229. @end float
  230. @float th@\'eor@`eme, theoreme
  231. A th@\'eor@`eme
  232. @caption{C A th@\'eor@`eme}
  233. @end float
  234. @float ,label but no type in chapter
  235. float with no type.
  236. @caption{C No type in chapter}
  237. @shortcaption{SC No type in chapter}
  238. @end float
  239. @float Warning, warning in chapter
  240. A warning
  241. @caption{C A warning in chapter}
  242. @shortcaption{SC A warning in chapter}
  243. @end float
  244. @menu
  245. * section::
  246. @end menu
  247. @node section
  248. @section A section
  249. @float Text, text in section
  250. A text in float no caption a label a type.
  251. @end float
  252. @node Unnumbered
  253. @unnumbered Unnumbered
  254. @menu
  255. * Section within unnumbered::
  256. @end menu
  257. @float Text, unnumbered float
  258. unnum
  259. @shortcaption{SC unnumbered float}
  260. @caption{C unnumbered float}
  261. @end float
  262. @float ,label but no type in unnumbered
  263. float with no type.
  264. @caption{C No type in unnumbered}
  265. @shortcaption{SC No type in unnumbered}
  266. @end float
  267. @node Section within unnumbered
  268. @section Section within unnumbered
  269. @float Text, Section within unnumbered float
  270. Section within unnumbered
  271. @shortcaption{SC Section within unnumbered}
  272. @caption{C Section within unnumbered}
  273. @end float
  274. @node Chapter with unnumbsubsec
  275. @chapter Chapter with unnumbsubsec
  276. @menu
  277. * unnumbered sec::
  278. @end menu
  279. @float Text, Chapter with subsec float
  280. Chap
  281. @shortcaption{SC Chapter with subsec}
  282. @caption{C Chapter with subsec}
  283. @end float
  284. @node unnumbered sec
  285. @unnumberedsec unnumbered sec
  286. @float Text, unnumbered sec float
  287. Chap
  288. @shortcaption{SC unnumbered sec float}
  289. @caption{C unnumbered sec float}
  290. @end float
  291. @float ,label but no type in unnumbered subsec in chapter
  292. float with no type.
  293. @caption{C No type in unnumbered subsec in chapter}
  294. @shortcaption{SC No type in unnumbered subsec in chapter}
  295. @end float
  296. @node Appendix for float
  297. @appendix Appendix for float
  298. @float Text, appendix sec float
  299. Appendix
  300. @shortcaption{SC appendix sec float}
  301. @caption{C appendix sec float}
  302. @end float
  303. @node list of floats
  304. @unnumbered list of floats
  305. See @ref{text in section}.
  306. And (@pxref{text in chapter}).
  307. @xref{text with a lot of features}.
  308. And now a ref (without manual or printed manual)
  309. @ref{text with a lot of features, cross ref, title}.
  310. And now a ref (with manual without printed manual)
  311. @ref{text with a lot of features, cross ref, title, manual}.
  312. And now a ref (without manual with a printed manual)
  313. @ref{text with a lot of features, cross ref, title,, printed manual title}.
  314. A ref to float without type @ref{label but no type}.
  315. @listoffloats Text
  316. @listoffloats th@\'eor@`eme
  317. @bye
  318. '],
  319. ['empty_listoffloats_with_floats',
  320. '
  321. @float , label1
  322. Label no caption.
  323. @end float
  324. @float , label2
  325. Label and caption.
  326. @caption{caption with label}
  327. @end float
  328. @float
  329. no label no caption
  330. @end float
  331. @float
  332. no label caption
  333. @caption{caption no label}
  334. @end float
  335. @listoffloats
  336. '],
  337. ['float_copying',
  338. '@copying
  339. @float Copyright notice, public domain
  340. Public domain is not really a licence, as it means than
  341. the author abandon his copyright.
  342. @caption{The Public Domain notice@footnote{
  343. The caption copying footnote
  344. @anchor{caption copying footnote anchor}
  345. @cindex indexed caption copying footnote
  346. @findex public domain function
  347. see @ref{Copying and floats}.
  348. }
  349. @anchor{public domain anchor}
  350. @cindex indexed caption
  351. @findex indexed caption function
  352. }
  353. @end float
  354. @end copying
  355. @node Top
  356. @top Top
  357. @insertcopying
  358. @menu
  359. * Copying and floats::
  360. @end menu
  361. @node Copying and floats
  362. @appendix Copying and floats
  363. @insertcopying
  364. @insertcopying
  365. @listoffloats Copyright notice
  366. @printindex cp
  367. @printindex fn
  368. '],
  369. ['comment_space_comand_in_float',
  370. '@node Top
  371. @float Text @ , label @ @c float
  372. Float
  373. @end float
  374. @listoffloats Text @ @c listoffloats
  375. ']
  376. );
  377. my %info_tests = (
  378. 'anchor_in_caption' => 1,
  379. 'footnote_in_caption' => 1,
  380. 'cindex_in_caption' => 1,
  381. 'float_copying' => 1,
  382. 'comment_space_comand_in_float' => 1,
  383. );
  384. foreach my $test (@test_cases) {
  385. $test->[2]->{'test_formats'} = ['plaintext'];
  386. if ($info_tests{$test->[0]}) {
  387. push @{$test->[2]->{'test_formats'}}, 'info';
  388. }
  389. push @{$test->[2]->{'test_formats'}}, 'html';
  390. }
  391. our ($arg_test_case, $arg_generate, $arg_debug);
  392. run_all ('float', \@test_cases, $arg_test_case,
  393. $arg_generate, $arg_debug);