diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2023-12-11 16:12:36 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2023-12-11 22:10:18 +0100 |
commit | c4d420a7fb8afed4bda776b9c808f3959184bca8 (patch) | |
tree | ba1710974a119590fefda207a06551042aecaf9d /embeddedobj/qa | |
parent | 638d25d141fdaf2ec54dfcc7d9d42207150761a3 (diff) |
Only run test dependent on MS Paint OLE class, if Paint is installed
Nowadays, MS Paint is optional component distributed through MS Store
(https://www.microsoft.com/store/productId/9PCFS5B6T72H); it may be
absent on some systems, resulting in tests relying on it failing.
[build CUT] embeddedobj_msole
[_RUN_____] testSaveOnThread::TestBody
warn:embeddedobj.ole:123152:104988:embeddedobj/source/msole/olevisual.cxx:207: Loaded object has no cached size!
warn:embeddedobj.ole:123152:104988:embeddedobj/source/msole/olevisual.cxx:232: OleEmbeddedObject::getVisualAreaSize: GetExtent() failed: com.sun.star.embed.UnreachableStateException message: "Class not registered
Bitmap Image at C:/lo/core/embeddedobj/source/msole/olecomponent.cxx:904" context: class OleComponent
warn:embeddedobj.ole:123152:104988:embeddedobj/source/msole/olecomponent.cxx:1142: OleComponent::GetCachedExtent: GetExtent() failed
warn:embeddedobj.ole:123152:104988:embeddedobj/source/msole/olevisual.cxx:257: OleEmbeddedObject::getVisualAreaSize: GetCachedExtent() failed: com.sun.star.lang.IllegalArgumentException message: "at C:/lo/core/embeddedobj/source/msole/olecomponent.cxx:1143" ArgumentPosition: 0
warn:embeddedobj.ole:123152:104988:embeddedobj/source/msole/olecomponent.cxx:1160: OleComponent::GetRecommendedExtent: GetExtent() failed
warn:embeddedobj.ole:123152:104988:embeddedobj/source/msole/olevisual.cxx:271: OleEmbeddedObject::getVisualAreaSize: GetRecommendedExtent() failed: com.sun.star.lang.IllegalArgumentException message: "at C:/lo/core/embeddedobj/source/msole/olecomponent.cxx:1161" ArgumentPosition: 0
warn:svtools.misc:123152:104988:svtools/source/misc/embedhlp.cxx:554: EmbeddedObjectRef::GetSize: no visual area size
warn:svtools.misc:123152:104988:svtools/source/misc/embedhlp.cxx:573: EmbeddedObjectRef::GetSize: empty size, defaulting to 5x5cm
warn:embeddedobj.ole:123152:104988:embeddedobj/source/msole/olevisual.cxx:207: Loaded object has no cached size!
warn:embeddedobj.ole:123152:104988:embeddedobj/source/msole/olevisual.cxx:232: OleEmbeddedObject::getVisualAreaSize: GetExtent() failed: com.sun.star.embed.UnreachableStateException message: "Class not registered
Bitmap Image at C:/lo/core/embeddedobj/source/msole/olecomponent.cxx:904" context: class OleComponent
warn:embeddedobj.ole:123152:104988:embeddedobj/source/msole/olecomponent.cxx:1142: OleComponent::GetCachedExtent: GetExtent() failed
warn:embeddedobj.ole:123152:104988:embeddedobj/source/msole/olevisual.cxx:257: OleEmbeddedObject::getVisualAreaSize: GetCachedExtent() failed: com.sun.star.lang.IllegalArgumentException message: "at C:/lo/core/embeddedobj/source/msole/olecomponent.cxx:1143" ArgumentPosition: 0
warn:embeddedobj.ole:123152:104988:embeddedobj/source/msole/olecomponent.cxx:1160: OleComponent::GetRecommendedExtent: GetExtent() failed
warn:embeddedobj.ole:123152:104988:embeddedobj/source/msole/olevisual.cxx:271: OleEmbeddedObject::getVisualAreaSize: GetRecommendedExtent() failed: com.sun.star.lang.IllegalArgumentException message: "at C:/lo/core/embeddedobj/source/msole/olecomponent.cxx:1161" ArgumentPosition: 0
warn:svtools.misc:123152:104988:svtools/source/misc/embedhlp.cxx:554: EmbeddedObjectRef::GetSize: no visual area size
warn:svtools.misc:123152:104988:svtools/source/misc/embedhlp.cxx:573: EmbeddedObjectRef::GetSize: empty size, defaulting to 5x5cm
C:/lo/core/test/source/xmltesttools.cxx:171:testSaveOnThread::TestBody
equality assertion failed
- Expected: 0.1665in
- Actual : 1.9685in
- In <>, attribute 'visible-area-width' of '//style:graphic-properties' incorrect value.
Check the class registration, and exit early if needed.
It is unclear if we should do something specific with MS Paint objects
on Windows, when MS Paint is absent, as we do on Linux; this is just
a quick workaround.
Similar checks might be needed in other tests.
Change-Id: I4d99bc3b13d84da53bdb5aa6259083a68ccc8871
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160597
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'embeddedobj/qa')
-rw-r--r-- | embeddedobj/qa/cppunit/msole.cxx | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/embeddedobj/qa/cppunit/msole.cxx b/embeddedobj/qa/cppunit/msole.cxx index 493b5c6a2ca6..6bd849584a4a 100644 --- a/embeddedobj/qa/cppunit/msole.cxx +++ b/embeddedobj/qa/cppunit/msole.cxx @@ -26,6 +26,10 @@ #include <unotools/ucbstreamhelper.hxx> #include <vcl/outdev.hxx> +#ifdef _WIN32 +#include <systools/win32/comtools.hxx> +#endif + using namespace ::com::sun::star; namespace @@ -39,6 +43,20 @@ public: { } }; + +bool IsPaintClassNotRegistered() +{ +#ifdef _WIN32 + sal::systools::CoInitializeGuard g(0); + // Check if MS Paint's {0003000A-0000-0000-C000-000000000046} is registered + CLSID clsidPaint{ 0x0003000A, 0000, 0000, { 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 } }; + LPOLESTR pProgId = nullptr; + if (ProgIDFromCLSID(clsidPaint, &pProgId) == REGDB_E_CLASSNOTREG) + return true; + CoTaskMemFree(pProgId); +#endif + return false; +} } namespace @@ -78,6 +96,9 @@ CPPUNIT_TEST_FIXTURE(Test, testSaveOnThread) return; } + if (IsPaintClassNotRegistered()) + return; + DBG_TESTSOLARMUTEX(); OUString aURL = createFileURL(u"reqif-ole2.xhtml"); uno::Sequence<beans::PropertyValue> aLoadProperties = { |