%% test-switch.tex
%% ===============
%% Typesetting test for every engine: changing the number of columns,
%% and spanning blocks.
%%
%%   pdflatex test-switch.tex   (or xelatex / lualatex / platex / uplatex)
%% The class is article (twoside): the expected state depends on its
%% layout.
%%
%% What is covered:
%%   * \ncolumn{4}[<material>]: one column to four columns, with
%%     material across all columns at the top of the page;
%%   * \spanblock: a new page with a block across two columns;
%%   * \spanblock*: a block that is put on a later page, like a float;
%%   * \twocolumn[<material>]: the number of columns stays four;
%%   * \cleardoublepage in four columns (an empty page is put out);
%%   * \onecolumn, a figure* with span and at in one column (an
%%     ordinary float), \ncolumn{2}.
%%
%% What to check:
%%   * NCOL-RESULT OK, and no error.
\documentclass[twoside]{article}
\usepackage{ncolumn}
\input{test-common}
\NCOLexpect{
  {page 1: N=1 fnres=0pt}
    {col 1: top=0.0pt bot=0.0pt marks=[]..[]}
  {page 2: N=4 fnres=0pt}
    {col 1: top=36.0pt bot=0.0pt marks=[four]..[four]}
    {col 2: top=36.0pt bot=0.0pt marks=[four]..[four]}
    {col 3: top=36.0pt bot=0.0pt marks=[four]..[four]}
    {col 4: top=36.0pt bot=0.0pt marks=[four]..[four]}
    {span: top from column 1, 4 wide, at 0.0pt}
  {page 3: N=4 fnres=0pt}
    {col 1: top=0.0pt bot=0.0pt marks=[blk]..[blk]}
    {col 2: top=0.0pt bot=0.0pt marks=[blk]..[blk]}
    {col 3: top=48.0pt bot=0.0pt marks=[blk]..[blk]}
    {col 4: top=48.0pt bot=0.0pt marks=[blk]..[blk]}
    {span: top from column 3, 2 wide, at 0.0pt}
  {page 4: N=4 fnres=0pt}
    {col 1: top=0.0pt bot=44.0pt marks=[blk]..[blk]}
    {col 2: top=0.0pt bot=44.0pt marks=[late]..[late]}
    {col 3: top=0.0pt bot=44.0pt marks=[late]..[late]}
    {col 4: top=0.0pt bot=0.0pt marks=[late]..[late]}
    {span: bot from column 1, 3 wide, at 0.0pt}
  {page 5: N=4 fnres=0pt}
    {col 1: top=24.0pt bot=0.0pt marks=[still4]..[still4]}
    {col 2: top=24.0pt bot=0.0pt marks=[still4]..[still4]}
    {col 3: top=24.0pt bot=0.0pt marks=[still4]..[still4]}
    {col 4: top=24.0pt bot=0.0pt marks=[still4]..[still4]}
    {span: top from column 1, 4 wide, at 0.0pt}
  {page 6: N=4 fnres=0pt}
    {col 1: top=0.0pt bot=0.0pt marks=[still4]..[still4]}
    {col 2: top=0.0pt bot=0.0pt marks=[still4]..[still4]}
    {col 3: top=0.0pt bot=0.0pt marks=[still4]..[still4]}
    {col 4: top=0.0pt bot=0.0pt marks=[still4]..[still4]}
  {page 7: N=4 fnres=0pt}
    {col 1: top=0.0pt bot=0.0pt marks=[odd]..[odd]}
    {col 2: top=0.0pt bot=0.0pt marks=[odd]..[odd]}
    {col 3: top=0.0pt bot=0.0pt marks=[odd]..[odd]}
    {col 4: top=0.0pt bot=0.0pt marks=[odd]..[odd]}
  {page 8: N=1 fnres=0pt}
    {col 1: top=0.0pt bot=0.0pt marks=[odd]..[odd]}
  {page 9: N=2 fnres=0pt}
    {col 1: top=0.0pt bot=0.0pt marks=[two]..[two]}
    {col 2: top=0.0pt bot=0.0pt marks=[two]..[two]}
  {page 10: N=2 fnres=0pt}
    {col 1: top=0.0pt bot=0.0pt marks=[two]..[two]}
    {col 2: top=0.0pt bot=0.0pt marks=[two]..[two]}
}
\begin{document}
\NCOLmark{one}\NCOLlines{10}
\ncolumn{4}[{\NCOLlines{3}}]
\NCOLmark{four}\NCOLlines{100}
\spanblock[span=2,at=tr]{\NCOLlines{4}}
\NCOLmark{blk}\NCOLlines{40}
\spanblock*[span=3,at=bl]{\NCOLlines{2}}
\NCOLlines{200}\NCOLmark{late}
\twocolumn[{\NCOLlines{2}}]
\NCOLmark{still4}\NCOLlines{20}
\cleardoublepage
\NCOLmark{odd}\NCOLlines{5}
\onecolumn
\NCOLmark{single}\NCOLlines{5}
\NCOLfloat{figure*}[span=2,at=tl]{30pt}
\ncolumn{2}
\NCOLmark{two}\NCOLlines{120}
\clearpage
\end{document}
