pluginsEnabled[] = 'odt';
parent::setUp();
}
/**
* Test ODT XML style definition import.
*/
public function test_simple_odt_import() {
$xml_code = '
';
$style = ODTStyle::importODTStyle($xml_code);
$this->assertNotNull($style);
$this->assertEquals($style->getFamily(), 'table-column');
$this->assertEquals($style->getProperty('style-name'), 'Table1.A');
$this->assertEquals($style->getPropertySection('style-name'), 'style');
$this->assertEquals($style->getProperty('style-family'), 'table-column');
$this->assertEquals($style->getPropertySection('style-family'), 'style');
$this->assertEquals($style->getProperty('column-width'), '5.609cm');
$this->assertEquals($style->getPropertySection('column-width'), 'table-column');
}
/**
* Test ODT XML style definition import and conversion to string.
*/
public function test_import_and_to_string() {
$xml_code = '
';
$expected = ''."\n";
$expected .= ' '."\n";
$expected .= ''."\n";
$style = ODTStyle::importODTStyle($xml_code);
$this->assertNotNull($style);
$style_string = $style->toString();
$this->assertEquals($expected, $style_string);
}
/**
* Test set and get of a property.
*/
public function test_set_and_get() {
$xml_code = '
';
$style = ODTStyle::importODTStyle($xml_code);
$this->assertNotNull($style);
$style->setProperty('column-width', '12.345cm');
$this->assertEquals($style->getProperty('column-width'), '12.345cm');
}
/**
* Test properties import and conversion to string.
*/
public function test_import_properties_and_to_string() {
$properties = array();
$properties ['style-name'] = 'Table1.A';
$properties ['column-width'] = '5.609cm';
$expected = ''."\n";
$expected .= ' '."\n";
$expected .= ''."\n";
$style = new ODTTableColumnStyle();
$this->assertNotNull($style);
$style->importProperties($properties, NULL);
$style_string = $style->toString();
$this->assertEquals($expected, $style_string);
}
}