xref: /dokuwiki/_test/tests/inc/common_inlineSVG.test.php (revision 71de557260410b9735850f9b06d5a1933afcc8d8)
1*71de5572SAndreas Gohr<?php
2*71de5572SAndreas Gohr
3*71de5572SAndreas Gohrclass common_embedSVG_test extends DokuWikiTest {
4*71de5572SAndreas Gohr
5*71de5572SAndreas Gohr    /**
6*71de5572SAndreas Gohr     * embed should succeed with a cleaned up result
7*71de5572SAndreas Gohr     */
8*71de5572SAndreas Gohr    function test_success() {
9*71de5572SAndreas Gohr        $file = mediaFN('wiki:test.svg');
10*71de5572SAndreas Gohr        $clean =
11*71de5572SAndreas Gohr            '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" '.
12*71de5572SAndreas Gohr            'width="64" height="64" viewBox="0 0 64 64"><path d="M64 20l-32-16-32 16 32 16 32-16zM32 '.
13*71de5572SAndreas Gohr            '9.311l21.379 10.689-21.379 10.689-21.379-10.689 21.379-10.689zM57.59 28.795l6.41 3.205-32 16-32-16 '.
14*71de5572SAndreas Gohr            '6.41-3.205 25.59 12.795zM57.59 40.795l6.41 3.205-32 16-32-16 6.41-3.205 25.59 12.795z" '.
15*71de5572SAndreas Gohr            'fill="#000000"></path></svg>';
16*71de5572SAndreas Gohr
17*71de5572SAndreas Gohr        $this->assertEquals($clean, inlinSVG($file));
18*71de5572SAndreas Gohr    }
19*71de5572SAndreas Gohr
20*71de5572SAndreas Gohr    /**
21*71de5572SAndreas Gohr     * embed should fail because of the file size limit
22*71de5572SAndreas Gohr     */
23*71de5572SAndreas Gohr    function test_fail() {
24*71de5572SAndreas Gohr        $file = mediaFN('wiki:test.svg');
25*71de5572SAndreas Gohr        $this->assertFalse(inlinSVG($file, 100));
26*71de5572SAndreas Gohr    }
27*71de5572SAndreas Gohr
28*71de5572SAndreas Gohr}
29