xref: /dokuwiki/_test/tests/inc/common_inlineSVG.test.php (revision 4cd2074f301b530ee51703ebb9cc1baf9749ae2c)
171de5572SAndreas Gohr<?php
271de5572SAndreas Gohr
371de5572SAndreas Gohrclass common_embedSVG_test extends DokuWikiTest {
471de5572SAndreas Gohr
571de5572SAndreas Gohr    /**
671de5572SAndreas Gohr     * embed should succeed with a cleaned up result
771de5572SAndreas Gohr     */
871de5572SAndreas Gohr    function test_success() {
971de5572SAndreas Gohr        $file = mediaFN('wiki:test.svg');
1071de5572SAndreas Gohr        $clean =
1171de5572SAndreas Gohr            '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" '.
1271de5572SAndreas Gohr            'width="64" height="64" viewBox="0 0 64 64"><path d="M64 20l-32-16-32 16 32 16 32-16zM32 '.
1371de5572SAndreas 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 '.
1471de5572SAndreas 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" '.
1571de5572SAndreas Gohr            'fill="#000000"></path></svg>';
1671de5572SAndreas Gohr
17*4cd2074fSAndreas Gohr        $this->assertEquals($clean, inlineSVG($file));
1871de5572SAndreas Gohr    }
1971de5572SAndreas Gohr
2071de5572SAndreas Gohr    /**
2171de5572SAndreas Gohr     * embed should fail because of the file size limit
2271de5572SAndreas Gohr     */
2371de5572SAndreas Gohr    function test_fail() {
2471de5572SAndreas Gohr        $file = mediaFN('wiki:test.svg');
25*4cd2074fSAndreas Gohr        $this->assertFalse(inlineSVG($file, 100));
2671de5572SAndreas Gohr    }
2771de5572SAndreas Gohr
2871de5572SAndreas Gohr}
29