13 require_once
'PU_testcase_dcp_document.php';
29 parent::setUpBeforeClass();
31 self::$outputDir = (
getTmpDir() .
"/oootest");
32 if (!is_dir(self::$outputDir)) mkdir(self::$outputDir);
34 self::beginTransaction();
36 self::importDocument(
"PU_data_dcp_oooLayout.ods");
40 self::rollbackTransaction();
46 copy(
$file, self::$outputDir .
'/' . $name);
56 $l = new \OOoLayout(sprintf(
"DCPTEST/Layout/%s", $layoutFile));
57 foreach ($data as $k => $v) {
62 $this->fail(sprintf(
"Generate %s", $f));
65 $this->assertEquals($expectedCode, $e->getDcpCode() ,
"not correct code");
66 $this->assertNotEmpty($e->getCorruptedFile());
78 $this->assertTrue($df->isAlive() ,
"family TST_OOOLAYOUT is not alive");
82 $this->assertTrue($instance->isAlive() ,
"document $lname is not alive");
84 foreach ($templates as $template) {
87 $file = $instance->viewDoc(
"DCPTEST:" . $template .
":B");
89 catch(\Dcp\
Layout\exception $e) {
90 $this->fail(sprintf(
"%s, \n file: %s", $e->getMessage() , $e->getCorruptedFile()));
92 $this->assertTrue(file_exists(
$file) ,
"fail layout $template : $file");
94 $this->
saveFileResult(
$file, sprintf(
"%s_%s.odt", str_replace(
'.odt',
'', $template) , $lname));
110 $this->assertTrue($df->isAlive() ,
"family TST_OOOLAYOUT is not alive");
114 $this->assertTrue($instance->isAlive() ,
"document $lname is not alive");
115 foreach ($templates as $template) {
118 $file = $instance->viewDoc(
"DCPTEST:" . $template .
":B");
119 $this->fail(sprintf(
"No error detected. Need find %s code", $expectedCode));
121 catch(\Dcp\
Layout\exception $e) {
122 $this->assertEquals($expectedCode, $e->getDcpCode() , sprintf(
"%s, \n corrupted file is : %s", $e->getMessage() , $e->getCorruptedFile()));
123 $this->assertNotEmpty($e->getCorruptedFile() ,
"no corrupted file found");
135 $l = new \OOoLayout(sprintf(
"DCPTEST/Layout/%s", $layoutFile));
136 foreach ($data as $k => $v) {
140 $this->assertNotEmpty($f,
"file is not produced");
149 foreach (
$data[
'setValue'] as $k => $v) {
153 $exceptionMessage =
'';
158 $exceptionMessage = $e->getMessage();
160 $this->assertTrue(is_file(
$out) , sprintf(
"Unexpected error from viewDoc(): %s",
$out));
161 $this->assertEmpty($exceptionMessage, sprintf(
"Unexpected exception from viewDoc(): %s", $exceptionMessage));
168 "PU_dcp_data_customOooLayout.odt",
177 "PU_dcp_data_customOooLayout.odt",
186 "PU_dcp_data_customOooLayout.odt",
188 "X" =>
"Tree 'test &zou;",
195 "PU_dcp_data_customOooLayout_no_automatic-styles.odt",
206 "PU_dcp_data_customOooLayout.odt",
214 "PU_dcp_data_customOooLayout.odt",
216 "X" =>
"Tree <text:line-break/>",
217 "Y" =>
"<text:span>Two</text:span>",
218 "Z" =>
'<text:span text:style-name="Tbold">One</text:span>"'
222 "PU_dcp_data_customOooLayout.odt",
224 "X" =>
"Tree & Two",
234 "PU_dcp_data_simpleOooLayout.xml",
237 "PU_dcp_data_errorInlineOooLayout.odt"
243 "PU_dcp_data_simpleOooLayout.xml",
246 "PU_dcp_data_errorPuceHtmlOooLayout.odt"
256 "PU_dcp_data_simpleOooLayout.xml",
259 "PU_dcp_data_simpleOooLayout.odt",
260 "PU_dcp_data_repeatMulti.odt",
261 "PU_dcp_data_repeatOne.odt",
262 "PU_dcp_data_repeatOooLayout.odt",
263 "PU_dcp_data_rowOooLayout.odt",
264 "PU_dcp_data_ifOooLayout.odt"
268 "PU_dcp_data_multipleOooLayout.xml",
271 "PU_dcp_data_multipleOooLayout.odt"
275 "PU_dcp_data_simpleOooLayout.xml",
278 "PU_dcp_data_simpleOooLayout.odt",
279 "PU_dcp_data_puceOooLayout.odt"
283 "PU_dcp_data_simpleOooLayout.xml",
286 "PU_dcp_data_simpleOooLayout.odt",
287 "PU_dcp_data_puceOooLayout.odt"
298 "family" =>
"TST_OOOLAYOUT",
300 "TST_TITLE" =>
"(SOH: \x01)"
302 "template" =>
"PU_dcp_data_simple1.odt"
307 "family" =>
"TST_OOOLAYOUT",
309 "HTML_MULTI" =>
"(SOH: \x01)"
311 "template" =>
"PU_dcp_data_simple1.odt"
317 "family" =>
"TST_OOOLAYOUT",
319 "TST_TITLE" =>
"(\xef\xbf\xbe)"
321 "template" =>
"PU_dcp_data_simple1.odt"
326 "family" =>
"TST_OOOLAYOUT",
328 "HTML_MULTI" =>
"(\xef\xbf\xbe)"
330 "template" =>
"PU_dcp_data_simple1.odt"
Layout is a template generator.
testErrorXML($layoutFile, array $data, $expectedCode)
testSimpleLayout($instances, $lname, array $templates)
testGoodXML($layoutFile, array $data)
static importDocument($file)
testInvalidXMLChars($data)
static tearDownAfterClass()
saveFileResult($file, $name)
testErrorHtmlLayout($instances, $lname, array $templates, $expectedCode)
createTmpDoc($dbaccess, $fromid, $defaultvalue=true)
if($file) if($subject==""&&$file) if($subject=="") $err
static setUpBeforeClass()