Annotation of embedaddon/php/ext/com_dotnet/tests/bug66431_1.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Bug #66431 Special Character via COM Interface (CP_UTF8), Application.Word
        !             3: --SKIPIF--
        !             4: <?php
        !             5: if (!extension_loaded("com_dotnet")){ echo "skip COM/.Net support not present"; }
        !             6: 
        !             7: try {
        !             8:        new COM("word.application", NULL, CP_UTF8); 
        !             9: } catch (Exception $e) {
        !            10:        die('skip ' . $e->getMessage();
        !            11: }
        !            12: 
        !            13: ?>
        !            14: --FILE--
        !            15: <?php
        !            16: 
        !            17: $text= "Xin chào cộng đồng PHP";
        !            18: $fpath = str_replace("/", "\\", dirname(__FILE__) . "/bug66431.docx");
        !            19: 
        !            20: com_load_typelib('Word.Application');
        !            21: 
        !            22: $Wrd = new COM("word.application", NULL, CP_UTF8); 
        !            23: $Wrd->Documents->Add();
        !            24: $Wrd->Selection->TypeText($text); 
        !            25: $Wrd->ActiveDocument->SaveAs($fpath);
        !            26: $Wrd->ActiveDocument->Close(false);
        !            27: $Wrd->Application->Quit();
        !            28: unset($Wrd);
        !            29: 
        !            30: $Wrd = new COM("word.application", NULL, CP_UTF8); 
        !            31: $Wrd->Documents->Open($fpath, NULL, false);
        !            32: $check_text = $Wrd->ActiveDocument->Range($Wrd->ActiveDocument->Sentences(1)->Start, $Wrd->ActiveDocument->Sentences(1)->End)->Text;
        !            33: $Wrd->ActiveDocument->Close(false);
        !            34: $Wrd->Application->Quit();
        !            35: unset($Wrd);
        !            36: 
        !            37: /* trim the returned text as we'll get windows eol from a word doc. */
        !            38: $result = (trim($check_text) == $text);
        !            39: 
        !            40: var_dump($result);
        !            41: 
        !            42: if (!$result) {
        !            43:        echo "Expected: '$check_text'\n";
        !            44:        echo "Have: '$text'\n";
        !            45: }
        !            46: 
        !            47: ?>
        !            48: ===DONE===
        !            49: --CLEAN--
        !            50: <?php
        !            51: 
        !            52: $fpath = str_replace("/", "\\", dirname(__FILE__) . "/bug66431.docx");
        !            53: 
        !            54: if (file_exists($fpath)) {
        !            55:        unlink($fpath);
        !            56: }
        !            57: ?>
        !            58: --EXPECT--
        !            59: bool(true)
        !            60: ===DONE===

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>