%% test-breakable.tex
%% ==================
%% Typesetting test for breakable boxes with "page footnote".
%%
%%   pdflatex test-breakable.tex   (or xelatex / lualatex)
%%   platex  test-breakable.tex && dvipdfmx test-breakable
%%   uplatex -jobname=test-breakable "\def\CLS{ujarticle}\input test-breakable"
%%
%% What is covered:
%%   * a box broken across pages by \tcbbreak, with footnotes in its
%%     title, in both parts of its upper part and in its lower part.
%%     Each footnote text is on the page of its mark;
%%   * a breakable box that is not broken, and an unbreakable box after
%%     the broken one.
%%
%% What to check:
%%   * TPF-RESULT OK, TPF-COUNTER OK, and no error or warning.
\ifdefined\CLS\else\def\CLS{article}\fi
\ifdefined\ptexversion\def\CLSOPT{dvipdfmx}\else\def\CLSOPT{}\fi
\expandafter\documentclass\expandafter[\CLSOPT]{\CLS}
\usepackage{tcbpagefootnote}
\tcbuselibrary{breakable}
\input{test-common}
\begin{document}
\section*{Breakable boxes}

\begin{tcolorbox}[breakable, page footnote]
A breakable box that is not broken\TPFfootnote{A footnote of the
  unbroken box.}.
\end{tcolorbox}

\begin{tcolorbox}[breakable, page footnote,
  title={A broken box\TPFfootnote{A footnote of the title.}}]
The first part of a broken box\TPFfootnote{A footnote of the first part.}.
\tcbbreak
The second part of the box\TPFfootnote{A footnote of the second part.}.
\tcblower
The lower part of the box\TPFfootnote{A footnote of the lower part.}.
\end{tcolorbox}

\begin{tcolorbox}[page footnote]
An unbreakable box after the broken one\TPFfootnote{A footnote of the
  unbreakable box.}.
\end{tcolorbox}

\TPFcounter{footnote}{6}
\end{document}
