Lines 66-71
public:
Link Here
|
66 |
void testTdf38225(); |
66 |
void testTdf38225(); |
67 |
void testTdf101242_ODF(); |
67 |
void testTdf101242_ODF(); |
68 |
void testTdf101242_settings(); |
68 |
void testTdf101242_settings(); |
|
|
69 |
void testTdf119392(); |
69 |
|
70 |
|
70 |
CPPUNIT_TEST_SUITE(SdMiscTest); |
71 |
CPPUNIT_TEST_SUITE(SdMiscTest); |
71 |
CPPUNIT_TEST(testTdf96206); |
72 |
CPPUNIT_TEST(testTdf96206); |
Lines 77-82
public:
Link Here
|
77 |
CPPUNIT_TEST(testTdf38225); |
78 |
CPPUNIT_TEST(testTdf38225); |
78 |
CPPUNIT_TEST(testTdf101242_ODF); |
79 |
CPPUNIT_TEST(testTdf101242_ODF); |
79 |
CPPUNIT_TEST(testTdf101242_settings); |
80 |
CPPUNIT_TEST(testTdf101242_settings); |
|
|
81 |
CPPUNIT_TEST(testTdf119392); |
80 |
CPPUNIT_TEST_SUITE_END(); |
82 |
CPPUNIT_TEST_SUITE_END(); |
81 |
|
83 |
|
82 |
virtual void registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) override |
84 |
virtual void registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) override |
Lines 488-493
void SdMiscTest::testTdf101242_settings()
Link Here
|
488 |
xDocShRef->DoClose(); |
490 |
xDocShRef->DoClose(); |
489 |
} |
491 |
} |
490 |
|
492 |
|
|
|
493 |
void SdMiscTest::testTdf119392() |
494 |
{ |
495 |
// Loads a document which has two user layers "V--" and "V-L". Inserts a new layer "-P-" between them. |
496 |
// Checks, that the bitfields in the saved file have the bits in the correct order. |
497 |
|
498 |
sd::DrawDocShellRef xDocShRef = Load(m_directories.getURLFromSrc("/sd/qa/unit/data/tdf119392_InsertLayer.odg"), ODG); |
499 |
CPPUNIT_ASSERT_MESSAGE("Failed to load file.", xDocShRef.is()); |
500 |
// Insert layer "-P-", not visible, printable, not locked |
501 |
SdrView* pView = xDocShRef -> GetViewShell()->GetView(); |
502 |
pView -> InsertNewLayer("-P-", 6); // 0..4 standard layer, 5 layer "V--" |
503 |
SdrPageView* pPageView = pView -> GetSdrPageView(); |
504 |
pPageView -> SetLayerVisible("-P-", false); |
505 |
pPageView -> SetLayerPrintable("-P-", true); |
506 |
pPageView -> SetLayerLocked("-P-", false); |
507 |
utl::TempFile aTempFile; |
508 |
aTempFile.EnableKillingFile(); |
509 |
save(xDocShRef.get(), getFormat(ODG), aTempFile ); |
510 |
|
511 |
// Verify correct bit order in bitfield in the items in settings.xml |
512 |
xmlDocPtr pXmlDoc = parseExport(aTempFile, "settings.xml"); |
513 |
CPPUNIT_ASSERT_MESSAGE("Failed to get 'settings.xml'", pXmlDoc); |
514 |
const OString sPathStart("/office:document-settings/office:settings/config:config-item-set[@config:name='ooo:view-settings']/config:config-item-map-indexed[@config:name='Views']/config:config-item-map-entry"); |
515 |
// First Byte is in order 'V-L -P- V-- measurelines controls backgroundobjects background layout' |
516 |
// Bits need to be: visible=10111111=0xbf=191 printable=01011111=0x5f=95 locked=10000000=0x80=128 |
517 |
// The values in file are Base64 encoded. |
518 |
OUString sBase64; |
519 |
uno::Sequence<sal_Int8> aDecodedSeq; |
520 |
sBase64 = getXPathContent(pXmlDoc, sPathStart + "/config:config-item[@config:name='VisibleLayers']"); |
521 |
CPPUNIT_ASSERT_MESSAGE( "Item VisibleLayers does not exists.", !sBase64.isEmpty()); |
522 |
comphelper::Base64::decode(aDecodedSeq, sBase64); |
523 |
CPPUNIT_ASSERT_EQUAL( 0xbF, static_cast<sal_uInt8>(aDecodedSeq[0]) & 0xff); // & 0xff forces unambigious types for CPPUNIT_ASSERT_EQUAL |
524 |
|
525 |
sBase64 = getXPathContent(pXmlDoc, sPathStart + "/config:config-item[@config:name='PrintableLayers']"); |
526 |
CPPUNIT_ASSERT_MESSAGE( "Item PrintableLayers does not exists.", !sBase64.isEmpty()); |
527 |
comphelper::Base64::decode(aDecodedSeq, sBase64); |
528 |
CPPUNIT_ASSERT_EQUAL( 0x5f, static_cast<sal_uInt8>(aDecodedSeq[0]) & 0xff); |
529 |
|
530 |
sBase64 = getXPathContent(pXmlDoc, sPathStart + "/config:config-item[@config:name='LockedLayers']"); |
531 |
CPPUNIT_ASSERT_MESSAGE( "Item LockedLayers does not exists.", !sBase64.isEmpty()); |
532 |
comphelper::Base64::decode(aDecodedSeq, sBase64); |
533 |
CPPUNIT_ASSERT_EQUAL( 0x80, static_cast<sal_uInt8>(aDecodedSeq[0]) & 0xff); |
534 |
|
535 |
xDocShRef->DoClose(); |
536 |
} |
537 |
|
491 |
CPPUNIT_TEST_SUITE_REGISTRATION(SdMiscTest); |
538 |
CPPUNIT_TEST_SUITE_REGISTRATION(SdMiscTest); |
492 |
|
539 |
|
493 |
CPPUNIT_PLUGIN_IMPLEMENT(); |
540 |
CPPUNIT_PLUGIN_IMPLEMENT(); |