1<?php
2
3namespace dokuwiki\plugin\dw2pdf\test;
4
5use DokuWikiTest;
6
7/**
8 * Class dw2pdf_renderer_dw2pdf_test
9 *
10 * @group plugin_dw2pdf
11 * @group plugins
12 */
13class RendererTest extends DokuWikiTest {
14
15    public function test() {
16        $Renderer = new \renderer_plugin_dw2pdf();
17
18        $levels = [
19            1,2,2,2,3,4,5,6,5,4,3,2,1, // index:0-12
20            3,4,3,1,                   // 13-16
21            2,3,4,2,3,4,1,             // 17-23
22            3,4,3,2,1,                 // 24-28
23            3,4,2,1,                   // 29-32
24            3,5,6,5,6,4,6,3,1,         // 33-41
25            3,6,4,5,6,4,3,6,2,1,       // 42-51
26            2,3,2,3,3                  // 52-56
27        ];
28        $expectedbookmarklevels = [
29            0,1,1,1,2,3,4,5,4,3,2,1,0,
30            1,2,1,0,
31            1,2,3,1,2,3,0,
32            1,2,1,1,0,
33            1,2,1,0,
34            1,2,3,2,3,2,3,2,0,
35            1,2,2,3,4,2,2,3,1,0,
36            1,2,1,2,2
37        ];
38        foreach ($levels as $i => $level) {
39            $actualbookmarklevel = $this->callInaccessibleMethod($Renderer, 'calculateBookmarklevel', [$level]);
40            $this->assertEquals($expectedbookmarklevels[$i], $actualbookmarklevel, "index:$i, lvl:$level");
41        }
42    }
43}
44