コード例 #1
0
ファイル: LostLinesTest.php プロジェクト: alipek/rtf
    function testPrependsSimpleText()
    {
        $startNote = '\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fswiss\\fprq2\\fcharset0 Arial;}{\\f1\\fnil\\fcharset0 Microsoft Sans Serif;}}
{\\colortbl ;\\red255\\green0\\blue0;\\red0\\green0\\blue255;}
\\viewkind4\\uc1\\pard\\cf1\\ul\\b\\f0\\fs17 4/2/2013 9:49:38 AM - bglass: test.\\par
3/29/2013 2:19:29 PM - gviguet:  l/vm in re to Counseling..............\\par';
        $note = new JoshRibakoff_Note();
        $note->setRTF($startNote);
        $note->prependNote(array('text' => 'simple note2'));
        $expectedNote = '\\rtf1\\ansi\\ansicpg1251\\deff0\\deflang1049{\\fonttbl{\\f0\\fswiss\\fprq2\\fcharset0 Arial;}{\\f1\\fnil\\fcharset0 Microsoft Sans Serif;}}
{\\colortbl \\red0\\green0\\blue0;\\red255\\green0\\blue0;\\red0\\green0\\blue255;}
\\f0\\fs17 simple note2\\par
\\viewkind4\\uc1\\pard\\cf1\\ul\\b\\f0\\fs17 4/2/2013 9:49:38 AM - bglass: test.\\par
3/29/2013 2:19:29 PM - gviguet:  l/vm in re to Counseling..............\\par';
        $this->assertEquals($expectedNote, $note->formatRTF(), 'should prepend note & format as RTF');
    }
コード例 #2
0
ファイル: NoteTest.php プロジェクト: alipek/rtf
    function testShouldTrimBlankLinesFromPlaintextOutput()
    {
        $startNote = '{\\rtf1\\ansi\\ansicpg1251\\deff0\\deflang1049{\\fonttbl{\\f0\\fnil\\fcharset0 Microsoft Sans Serif;}{\\f1\\fnil\\fcharset204 Microsoft Sans Serif;}}
\\uc1\\pard\\f0\\fs17 test
\\cf2\\b0\\par
\\uc1\\pard\\f0\\fs17 test2
}';
        $note = new JoshRibakoff_Note();
        $note->setRTF($startNote);
        $this->assertEquals("test\ntest2", $note->formatPlaintext(), 'should not have blank lines in plaintext output');
    }