GuiAllTest.php 2.05 KB
Newer Older
Michael Herold's avatar
Michael Herold committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
/*
 * Copyright (C) 2015 Michael Herold <quabla@hemio.de>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

namespace hemio\edentata\tests;

use hemio\html;
use hemio\form;

require_once 'tests/Helpers.php';

class FirstTest extends \Helpers
{

    public function test1()
    {
        $this->assertEquals('', '');
    }

    public function test2()
    {
        $doc = new html\Document(new html\Str('Test'));
        $doc->getHtml()->getHead()->addCssFile('style.css');

        $form = new form\FormPost('test');
        $doc->getHtml()->getBody()->addChild($form);

        $window = new \hemio\edentata\gui\Window('Abc', 'Subtitle');
        $form->addChild($window);
        $window->addButtonRight(new form\FieldSubmit('submit', _('Submit')));

        $selectbox = new \hemio\edentata\gui\Selectbox();
        $window->addChild($selectbox);

        $options   = new form\Container();
        $options[] = new form\FieldSubmit('submit', _('Submit'));
        $selectbox->setOptions($options);

        for ($i = 1; $i < 20; $i++) {
            $selectbox->addItem('test'.$i, sprintf('Test Nr. %d', $i));
        }

        $listbox = new \hemio\edentata\gui\Listbox();
        $window->addChild($listbox);

        for ($i = 1; $i < 20; $i++) {
            $str = new html\Str(sprintf(_('Test Nr. %d'), $i));
            $a   = new html\A();
            $a[] = $str;
            $listbox->addLine($a);
        }


        $this->_assertEqualsXmlFile($doc, 'selectbox.html');
    }
}