Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
836a77e5
Kaydet (Commit)
836a77e5
authored
Tem 01, 2016
tarafından
Katarina Behrens
Kaydeden (comit)
Thorsten Behrens
Agu 18, 2016
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
screenshots: use new bootstrap fixture in sc and sd
Change-Id: Ida0d3179726896b32b0876b1855b1f0be12d3b48
üst
13184da2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
196 deletions
+10
-196
screenshots.cxx
sc/qa/unit/screenshots/screenshots.cxx
+2
-100
viewfunc.hxx
sc/source/ui/inc/viewfunc.hxx
+1
-1
dialogs-test.cxx
sd/qa/unit/dialogs-test.cxx
+5
-95
tabdlg.cxx
vcl/source/window/tabdlg.cxx
+2
-0
No files found.
sc/qa/unit/screenshots/screenshots.cxx
Dosyayı görüntüle @
836a77e5
...
@@ -7,9 +7,7 @@
...
@@ -7,9 +7,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
*/
#include <test/bootstrapfixture.hxx>
#include <test/screenshot_test.hxx>
#include <unotest/macros_test.hxx>
#include <test/xmltesttools.hxx>
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/Desktop.hpp>
#include <comphelper/dispatchcommand.hxx>
#include <comphelper/dispatchcommand.hxx>
...
@@ -45,53 +43,26 @@
...
@@ -45,53 +43,26 @@
using
namespace
css
;
using
namespace
css
;
#if !defined(WNT) && !defined(MACOSX)
static
const
char
*
DATA_DIRECTORY
=
"/sc/qa/unit/screenshots/data/"
;
static
const
char
*
DATA_DIRECTORY
=
"/sc/qa/unit/screenshots/data/"
;
static
const
char
*
SCREENSHOT_DIRECTORY
=
"/workdir/screenshots/"
;
#endif
namespace
{
class
ScScreenshotTest
:
public
ScreenshotTest
void
splitHelpId
(
OString
&
rHelpId
,
OUString
&
rDirname
,
OUString
&
rBasename
)
{
sal_Int32
nIndex
=
rHelpId
.
lastIndexOf
(
'/'
);
if
(
nIndex
>
0
)
rDirname
=
OStringToOUString
(
rHelpId
.
copy
(
0
,
nIndex
),
RTL_TEXTENCODING_UTF8
);
if
(
rHelpId
.
getLength
()
>
nIndex
+
1
)
rBasename
=
OStringToOUString
(
rHelpId
.
copy
(
nIndex
+
1
),
RTL_TEXTENCODING_UTF8
);
}
}
class
ScScreenshotTest
:
public
test
::
BootstrapFixture
,
public
unotest
::
MacrosTest
,
public
XmlTestTools
{
{
public
:
public
:
ScScreenshotTest
();
ScScreenshotTest
();
virtual
void
setUp
()
SAL_OVERRIDE
;
virtual
void
tearDown
()
SAL_OVERRIDE
;
#if !defined(WNT) && !defined(MACOSX)
void
testOpeningModalDialogs
();
void
testOpeningModalDialogs
();
//void testOpeningModelessDialogs();
//void testOpeningModelessDialogs();
#endif
CPPUNIT_TEST_SUITE
(
ScScreenshotTest
);
CPPUNIT_TEST_SUITE
(
ScScreenshotTest
);
#if !defined(WNT) && !defined(MACOSX)
CPPUNIT_TEST
(
testOpeningModalDialogs
);
CPPUNIT_TEST
(
testOpeningModalDialogs
);
//CPPUNIT_TEST(testOpeningModelessDialogs);
//CPPUNIT_TEST(testOpeningModelessDialogs);
#endif
CPPUNIT_TEST_SUITE_END
();
CPPUNIT_TEST_SUITE_END
();
private
:
private
:
#if !defined(WNT) && !defined(MACOSX)
void
initializeWithDoc
(
const
char
*
pName
);
void
initializeWithDoc
(
const
char
*
pName
);
VclAbstractDialog
*
createDialogByID
(
sal_uInt32
nID
);
VclAbstractDialog
*
createDialogByID
(
sal_uInt32
nID
);
void
dumpDialogToPath
(
VclAbstractDialog
&
rDialog
);
void
saveScreenshot
(
VclAbstractDialog
&
rDialog
);
#endif
uno
::
Reference
<
lang
::
XComponent
>
mxComponent
;
uno
::
Reference
<
lang
::
XComponent
>
mxComponent
;
SfxObjectShell
*
pFoundShell
;
SfxObjectShell
*
pFoundShell
;
...
@@ -107,25 +78,6 @@ ScScreenshotTest::ScScreenshotTest()
...
@@ -107,25 +78,6 @@ ScScreenshotTest::ScScreenshotTest()
{
{
}
}
void
ScScreenshotTest
::
setUp
()
{
test
::
BootstrapFixture
::
setUp
();
mxDesktop
.
set
(
css
::
frame
::
Desktop
::
create
(
comphelper
::
getComponentContext
(
getMultiServiceFactory
())));
osl
::
FileBase
::
RC
err
=
osl
::
Directory
::
create
(
m_directories
.
getURLFromSrc
(
SCREENSHOT_DIRECTORY
)
);
CPPUNIT_ASSERT_MESSAGE
(
"Failed to create screenshot directory"
,
(
err
==
osl
::
FileBase
::
E_None
||
err
==
osl
::
FileBase
::
E_EXIST
)
);
}
void
ScScreenshotTest
::
tearDown
()
{
if
(
mxComponent
.
is
())
mxComponent
->
dispose
();
test
::
BootstrapFixture
::
tearDown
();
}
#if !defined(WNT) && !defined(MACOSX)
void
ScScreenshotTest
::
initializeWithDoc
(
const
char
*
pName
)
void
ScScreenshotTest
::
initializeWithDoc
(
const
char
*
pName
)
{
{
if
(
mxComponent
.
is
())
if
(
mxComponent
.
is
())
...
@@ -283,54 +235,6 @@ VclAbstractDialog* ScScreenshotTest::createDialogByID( sal_uInt32 nID )
...
@@ -283,54 +235,6 @@ VclAbstractDialog* ScScreenshotTest::createDialogByID( sal_uInt32 nID )
return
pReturnDialog
;
return
pReturnDialog
;
}
}
void
ScScreenshotTest
::
saveScreenshot
(
VclAbstractDialog
&
rDialog
)
{
const
Bitmap
aScreenshot
(
rDialog
.
createScreenshot
());
if
(
!
aScreenshot
.
IsEmpty
())
{
OString
aScreenshotId
=
rDialog
.
GetScreenshotId
();
OUString
aDirname
,
aBasename
;
splitHelpId
(
aScreenshotId
,
aDirname
,
aBasename
);
aDirname
=
OUString
::
createFromAscii
(
SCREENSHOT_DIRECTORY
)
+
aDirname
;
osl
::
FileBase
::
RC
err
=
osl
::
Directory
::
createPath
(
m_directories
.
getURLFromSrc
(
aDirname
));
CPPUNIT_ASSERT_MESSAGE
(
OUStringToOString
(
"Failed to create "
+
aDirname
,
RTL_TEXTENCODING_UTF8
).
getStr
(),
(
err
==
osl
::
FileBase
::
E_None
||
err
==
osl
::
FileBase
::
E_EXIST
)
);
OUString
aFullPath
=
m_directories
.
getSrcRootPath
()
+
aDirname
+
"/"
+
aBasename
+
".png"
;
SvFileStream
aNew
(
aFullPath
,
StreamMode
::
WRITE
|
StreamMode
::
TRUNC
);
CPPUNIT_ASSERT_MESSAGE
(
OUStringToOString
(
"Failed to open "
+
OUString
::
number
(
aNew
.
GetErrorCode
()),
RTL_TEXTENCODING_UTF8
).
getStr
(),
aNew
.
IsOpen
()
);
vcl
::
PNGWriter
aPNGWriter
(
aScreenshot
);
aPNGWriter
.
Write
(
aNew
);
}
}
void
ScScreenshotTest
::
dumpDialogToPath
(
VclAbstractDialog
&
rDialog
)
{
const
std
::
vector
<
OString
>
aPageDescriptions
(
rDialog
.
getAllPageUIXMLDescriptions
());
if
(
aPageDescriptions
.
size
())
{
for
(
sal_uInt32
a
(
0
);
a
<
aPageDescriptions
.
size
();
a
++
)
{
if
(
rDialog
.
selectPageByUIXMLDescription
(
aPageDescriptions
[
a
]))
{
saveScreenshot
(
rDialog
);
}
else
{
CPPUNIT_ASSERT
(
false
);
}
}
}
else
{
saveScreenshot
(
rDialog
);
}
}
void
ScScreenshotTest
::
testOpeningModalDialogs
()
void
ScScreenshotTest
::
testOpeningModalDialogs
()
{
{
initializeWithDoc
(
"empty.ods"
);
initializeWithDoc
(
"empty.ods"
);
...
@@ -345,8 +249,6 @@ void ScScreenshotTest::testOpeningModalDialogs()
...
@@ -345,8 +249,6 @@ void ScScreenshotTest::testOpeningModalDialogs()
}
}
}
}
#endif
CPPUNIT_TEST_SUITE_REGISTRATION
(
ScScreenshotTest
);
CPPUNIT_TEST_SUITE_REGISTRATION
(
ScScreenshotTest
);
CPPUNIT_PLUGIN_IMPLEMENT
();
CPPUNIT_PLUGIN_IMPLEMENT
();
...
...
sc/source/ui/inc/viewfunc.hxx
Dosyayı görüntüle @
836a77e5
...
@@ -70,7 +70,7 @@ public:
...
@@ -70,7 +70,7 @@ public:
ScViewFunc
(
vcl
::
Window
*
pParent
,
ScDocShell
&
rDocSh
,
ScTabViewShell
*
pViewShell
);
ScViewFunc
(
vcl
::
Window
*
pParent
,
ScDocShell
&
rDocSh
,
ScTabViewShell
*
pViewShell
);
~
ScViewFunc
();
~
ScViewFunc
();
const
ScPatternAttr
*
GetSelectionPattern
();
SC_DLLPUBLIC
const
ScPatternAttr
*
GetSelectionPattern
();
void
GetSelectionFrame
(
SvxBoxItem
&
rLineOuter
,
void
GetSelectionFrame
(
SvxBoxItem
&
rLineOuter
,
SvxBoxInfoItem
&
rLineInner
);
SvxBoxInfoItem
&
rLineInner
);
...
...
sd/qa/unit/dialogs-test.cxx
Dosyayı görüntüle @
836a77e5
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*/
*/
#include <sal/config.h>
#include <sal/config.h>
#include <test/
bootstrapfixture
.hxx>
#include <test/
screenshot_test
.hxx>
#include <rtl/strbuf.hxx>
#include <rtl/strbuf.hxx>
#include <osl/file.hxx>
#include <osl/file.hxx>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/lang/XComponent.hpp>
...
@@ -55,32 +55,13 @@
...
@@ -55,32 +55,13 @@
#include <comphelper/processfactory.hxx>
#include <comphelper/processfactory.hxx>
#include <unotest/macros_test.hxx>
#include <unotest/macros_test.hxx>
//#include "DrawController.hxx"
//#include "ViewShellBase.hxx"
using
namespace
::
com
::
sun
::
star
;
using
namespace
::
com
::
sun
::
star
;
static
const
char
*
SCREENSHOT_DIRECTORY
=
"/workdir/screenshots/"
;
namespace
{
void
splitHelpId
(
OString
&
rHelpId
,
OUString
&
rDirname
,
OUString
&
rBasename
)
{
sal_Int32
nIndex
=
rHelpId
.
lastIndexOf
(
'/'
);
if
(
nIndex
>
0
)
rDirname
=
OStringToOUString
(
rHelpId
.
copy
(
0
,
nIndex
),
RTL_TEXTENCODING_UTF8
);
if
(
rHelpId
.
getLength
()
>
nIndex
+
1
)
rBasename
=
OStringToOUString
(
rHelpId
.
copy
(
nIndex
+
1
),
RTL_TEXTENCODING_UTF8
);
}
}
/// Test opening a dialog in sd
/// Test opening a dialog in sd
class
SdDialogsTest
:
public
test
::
BootstrapFixture
,
public
unotest
::
Macros
Test
class
SdDialogsTest
:
public
Screenshot
Test
{
{
private
:
private
:
/// Document and ComponentContext
/// Document and ComponentContext
uno
::
Reference
<
uno
::
XComponentContext
>
mxComponentContext
;
uno
::
Reference
<
lang
::
XComponent
>
mxComponent
;
uno
::
Reference
<
lang
::
XComponent
>
mxComponent
;
/// initially created SdAbstractDialogFactory and pointer to document
/// initially created SdAbstractDialogFactory and pointer to document
...
@@ -106,17 +87,14 @@ private:
...
@@ -106,17 +87,14 @@ private:
const
SfxItemSet
&
getEmptySfxItemSet
();
const
SfxItemSet
&
getEmptySfxItemSet
();
const
SfxItemSet
&
getEmptyFillStyleSfxItemSet
();
const
SfxItemSet
&
getEmptyFillStyleSfxItemSet
();
/// central method
s
: dialog creation and dumping to target directory (path)
/// central method: dialog creation and dumping to target directory (path)
VclAbstractDialog
*
createDialogByID
(
sal_uInt32
nID
);
VclAbstractDialog
*
createDialogByID
(
sal_uInt32
nID
);
void
dumpDialogToPath
(
VclAbstractDialog
&
rDlg
);
void
saveScreenshot
(
VclAbstractDialog
&
rDlg
);
public
:
public
:
SdDialogsTest
();
SdDialogsTest
();
~
SdDialogsTest
();
~
SdDialogsTest
();
virtual
void
setUp
()
override
;
virtual
void
setUp
()
override
;
virtual
void
tearDown
()
override
;
// try to open a dialog
// try to open a dialog
void
openAnyDialog
();
void
openAnyDialog
();
...
@@ -127,8 +105,7 @@ public:
...
@@ -127,8 +105,7 @@ public:
};
};
SdDialogsTest
::
SdDialogsTest
()
SdDialogsTest
::
SdDialogsTest
()
:
mxComponentContext
(),
:
mxComponent
(),
mxComponent
(),
mpFact
(
nullptr
),
mpFact
(
nullptr
),
mpImpressDocument
(
nullptr
),
mpImpressDocument
(
nullptr
),
mpDocShell
(
nullptr
),
mpDocShell
(
nullptr
),
...
@@ -146,31 +123,16 @@ SdDialogsTest::~SdDialogsTest()
...
@@ -146,31 +123,16 @@ SdDialogsTest::~SdDialogsTest()
void
SdDialogsTest
::
setUp
()
void
SdDialogsTest
::
setUp
()
{
{
test
::
BootstrapFixture
::
setUp
();
ScreenshotTest
::
setUp
();
mxComponentContext
.
set
(
comphelper
::
getComponentContext
(
getMultiServiceFactory
()));
mxDesktop
.
set
(
frame
::
Desktop
::
create
(
mxComponentContext
));
mpFact
=
SdAbstractDialogFactory
::
Create
();
mpFact
=
SdAbstractDialogFactory
::
Create
();
mxComponent
=
loadFromDesktop
(
"private:factory/simpress"
,
"com.sun.star.presentation.PresentationDocument"
);
mxComponent
=
loadFromDesktop
(
"private:factory/simpress"
,
"com.sun.star.presentation.PresentationDocument"
);
CPPUNIT_ASSERT
(
mxComponent
.
is
());
CPPUNIT_ASSERT
(
mxComponent
.
is
());
osl
::
FileBase
::
RC
err
=
osl
::
Directory
::
create
(
m_directories
.
getURLFromSrc
(
SCREENSHOT_DIRECTORY
)
);
CPPUNIT_ASSERT_MESSAGE
(
"Failed to create screenshot directory"
,
(
err
==
osl
::
FileBase
::
E_None
||
err
==
osl
::
FileBase
::
E_EXIST
)
);
mpImpressDocument
=
dynamic_cast
<
SdXImpressDocument
*>
(
mxComponent
.
get
());
mpImpressDocument
=
dynamic_cast
<
SdXImpressDocument
*>
(
mxComponent
.
get
());
CPPUNIT_ASSERT
(
mpImpressDocument
);
CPPUNIT_ASSERT
(
mpImpressDocument
);
}
}
void
SdDialogsTest
::
tearDown
()
{
//if (mxComponent.is())
//{
// mxComponent->dispose();
//}
test
::
BootstrapFixture
::
tearDown
();
}
SdAbstractDialogFactory
*
SdDialogsTest
::
getSdAbstractDialogFactory
()
SdAbstractDialogFactory
*
SdDialogsTest
::
getSdAbstractDialogFactory
()
{
{
return
mpFact
;
return
mpFact
;
...
@@ -611,58 +573,6 @@ VclAbstractDialog* SdDialogsTest::createDialogByID(sal_uInt32 nID)
...
@@ -611,58 +573,6 @@ VclAbstractDialog* SdDialogsTest::createDialogByID(sal_uInt32 nID)
return
pRetval
;
return
pRetval
;
}
}
void
SdDialogsTest
::
saveScreenshot
(
VclAbstractDialog
&
rDlg
)
{
const
Bitmap
aScreenshot
(
rDlg
.
createScreenshot
());
if
(
!
aScreenshot
.
IsEmpty
())
{
OString
aScreenshotId
=
rDlg
.
GetScreenshotId
();
OUString
aDirname
,
aBasename
;
splitHelpId
(
aScreenshotId
,
aDirname
,
aBasename
);
aDirname
=
OUString
::
createFromAscii
(
SCREENSHOT_DIRECTORY
)
+
aDirname
;
osl
::
FileBase
::
RC
err
=
osl
::
Directory
::
createPath
(
m_directories
.
getURLFromSrc
(
aDirname
));
CPPUNIT_ASSERT_MESSAGE
(
OUStringToOString
(
"Failed to create "
+
aDirname
,
RTL_TEXTENCODING_UTF8
).
getStr
(),
(
err
==
osl
::
FileBase
::
E_None
||
err
==
osl
::
FileBase
::
E_EXIST
)
);
OUString
aFullPath
=
m_directories
.
getSrcRootPath
()
+
aDirname
+
"/"
+
aBasename
+
".png"
;
SvFileStream
aNew
(
aFullPath
,
StreamMode
::
WRITE
|
StreamMode
::
TRUNC
);
CPPUNIT_ASSERT_MESSAGE
(
OUStringToOString
(
"Failed to open "
+
OUString
::
number
(
aNew
.
GetErrorCode
()),
RTL_TEXTENCODING_UTF8
).
getStr
(),
aNew
.
IsOpen
()
);
vcl
::
PNGWriter
aPNGWriter
(
aScreenshot
);
aPNGWriter
.
Write
(
aNew
);
}
}
void
SdDialogsTest
::
dumpDialogToPath
(
VclAbstractDialog
&
rDlg
)
{
// for dumping, a lossless format is needed. It may be seen if the created data
// will be further modified/reduced, but for a input creating step it is
// unavoidable to use a lossless format initially
const
std
::
vector
<
OString
>
aPageDescriptions
(
rDlg
.
getAllPageUIXMLDescriptions
());
if
(
aPageDescriptions
.
size
())
{
for
(
sal_uInt32
a
(
0
);
a
<
aPageDescriptions
.
size
();
a
++
)
{
if
(
rDlg
.
selectPageByUIXMLDescription
(
aPageDescriptions
[
a
]))
{
saveScreenshot
(
rDlg
);
}
else
{
CPPUNIT_ASSERT
(
false
);
}
}
}
else
{
saveScreenshot
(
rDlg
);
}
}
void
SdDialogsTest
::
openAnyDialog
()
void
SdDialogsTest
::
openAnyDialog
()
{
{
// example for SfxTabDialog: 5
// example for SfxTabDialog: 5
...
...
vcl/source/window/tabdlg.cxx
Dosyayı görüntüle @
836a77e5
...
@@ -268,6 +268,8 @@ vcl::Window* findTabControl(vcl::Window* pCurrent)
...
@@ -268,6 +268,8 @@ vcl::Window* findTabControl(vcl::Window* pCurrent)
pChild
=
pChild
->
GetWindow
(
GetWindowType
::
Next
);
pChild
=
pChild
->
GetWindow
(
GetWindowType
::
Next
);
}
}
return
nullptr
;
}
}
std
::
vector
<
OString
>
TabDialog
::
getAllPageUIXMLDescriptions
()
const
std
::
vector
<
OString
>
TabDialog
::
getAllPageUIXMLDescriptions
()
const
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment