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
b3ef2a7f
Kaydet (Commit)
b3ef2a7f
authored
Mar 17, 2015
tarafından
Miklos Vajna
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add SwXTextDocument::registerCallback() testcase.
Change-Id: I435bb683bae1634f156b3912e6120d479a917b00
üst
82bc3505
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
1 deletion
+47
-1
tiledrendering.cxx
sw/qa/extras/tiledrendering/tiledrendering.cxx
+45
-1
unotxdoc.cxx
sw/source/uibase/uno/unotxdoc.cxx
+2
-0
No files found.
sw/qa/extras/tiledrendering/tiledrendering.cxx
Dosyayı görüntüle @
b3ef2a7f
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
#include <swmodeltestbase.hxx>
#include <swmodeltestbase.hxx>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <comphelper/string.hxx>
#include <svx/svdpage.hxx>
#include <svx/svdpage.hxx>
#include <svx/svdview.hxx>
#include <svx/svdview.hxx>
#include <crsskip.hxx>
#include <crsskip.hxx>
...
@@ -20,14 +21,15 @@ static const char* DATA_DIRECTORY = "/sw/qa/extras/tiledrendering/data/";
...
@@ -20,14 +21,15 @@ static const char* DATA_DIRECTORY = "/sw/qa/extras/tiledrendering/data/";
/// Testsuite for the SwXTextDocument methods implementing the vcl::ITiledRenderable interface.
/// Testsuite for the SwXTextDocument methods implementing the vcl::ITiledRenderable interface.
class
SwTiledRenderingTest
:
public
SwModelTestBase
class
SwTiledRenderingTest
:
public
SwModelTestBase
{
{
public
:
public
:
void
testRegisterCallback
();
void
testPostMouseEvent
();
void
testPostMouseEvent
();
void
testSetTextSelection
();
void
testSetTextSelection
();
void
testSetGraphicSelection
();
void
testSetGraphicSelection
();
void
testResetSelection
();
void
testResetSelection
();
CPPUNIT_TEST_SUITE
(
SwTiledRenderingTest
);
CPPUNIT_TEST_SUITE
(
SwTiledRenderingTest
);
CPPUNIT_TEST
(
testRegisterCallback
);
CPPUNIT_TEST
(
testPostMouseEvent
);
CPPUNIT_TEST
(
testPostMouseEvent
);
CPPUNIT_TEST
(
testSetTextSelection
);
CPPUNIT_TEST
(
testSetTextSelection
);
CPPUNIT_TEST
(
testSetGraphicSelection
);
CPPUNIT_TEST
(
testSetGraphicSelection
);
...
@@ -36,6 +38,9 @@ public:
...
@@ -36,6 +38,9 @@ public:
private
:
private
:
SwXTextDocument
*
createDoc
(
const
char
*
pName
);
SwXTextDocument
*
createDoc
(
const
char
*
pName
);
static
void
callback
(
int
nType
,
const
char
*
pPayload
,
void
*
pData
);
void
callbackImpl
(
int
nType
,
const
char
*
pPayload
);
Rectangle
m_aInvalidation
;
};
};
SwXTextDocument
*
SwTiledRenderingTest
::
createDoc
(
const
char
*
pName
)
SwXTextDocument
*
SwTiledRenderingTest
::
createDoc
(
const
char
*
pName
)
...
@@ -48,6 +53,45 @@ SwXTextDocument* SwTiledRenderingTest::createDoc(const char* pName)
...
@@ -48,6 +53,45 @@ SwXTextDocument* SwTiledRenderingTest::createDoc(const char* pName)
return
pTextDocument
;
return
pTextDocument
;
}
}
void
SwTiledRenderingTest
::
callback
(
int
nType
,
const
char
*
pPayload
,
void
*
pData
)
{
static_cast
<
SwTiledRenderingTest
*>
(
pData
)
->
callbackImpl
(
nType
,
pPayload
);
}
void
SwTiledRenderingTest
::
callbackImpl
(
int
nType
,
const
char
*
pPayload
)
{
switch
(
nType
)
{
case
LOK_CALLBACK_INVALIDATE_TILES
:
{
if
(
m_aInvalidation
.
IsEmpty
())
{
uno
::
Sequence
<
OUString
>
aSeq
=
comphelper
::
string
::
convertCommaSeparated
(
OUString
::
createFromAscii
(
pPayload
));
CPPUNIT_ASSERT_EQUAL
(
static_cast
<
sal_Int32
>
(
4
),
aSeq
.
getLength
());
m_aInvalidation
.
setX
(
aSeq
[
0
].
toInt32
());
m_aInvalidation
.
setY
(
aSeq
[
1
].
toInt32
());
m_aInvalidation
.
setWidth
(
aSeq
[
2
].
toInt32
());
m_aInvalidation
.
setHeight
(
aSeq
[
3
].
toInt32
());
}
}
break
;
}
}
void
SwTiledRenderingTest
::
testRegisterCallback
()
{
SwXTextDocument
*
pXTextDocument
=
createDoc
(
"dummy.fodt"
);
pXTextDocument
->
registerCallback
(
&
SwTiledRenderingTest
::
callback
,
this
);
SwWrtShell
*
pWrtShell
=
pXTextDocument
->
GetDocShell
()
->
GetWrtShell
();
// Insert a character at the begining of the document.
pWrtShell
->
Insert
(
"x"
);
// Check that the top left 256x256px tile would be invalidated.
Rectangle
aTopLeft
(
0
,
0
,
256
*
15
,
256
*
15
);
// 1 px = 15 twips, assuming 96 DPI.
CPPUNIT_ASSERT
(
!
m_aInvalidation
.
IsEmpty
());
CPPUNIT_ASSERT
(
m_aInvalidation
.
IsOver
(
aTopLeft
));
}
void
SwTiledRenderingTest
::
testPostMouseEvent
()
void
SwTiledRenderingTest
::
testPostMouseEvent
()
{
{
SwXTextDocument
*
pXTextDocument
=
createDoc
(
"dummy.fodt"
);
SwXTextDocument
*
pXTextDocument
=
createDoc
(
"dummy.fodt"
);
...
...
sw/source/uibase/uno/unotxdoc.cxx
Dosyayı görüntüle @
b3ef2a7f
...
@@ -3179,6 +3179,8 @@ void SwXTextDocument::initializeForTiledRendering()
...
@@ -3179,6 +3179,8 @@ void SwXTextDocument::initializeForTiledRendering()
void
SwXTextDocument
::
registerCallback
(
LibreOfficeKitCallback
pCallback
,
void
*
pData
)
void
SwXTextDocument
::
registerCallback
(
LibreOfficeKitCallback
pCallback
,
void
*
pData
)
{
{
SolarMutexGuard
aGuard
;
SwDoc
*
pDoc
=
pDocShell
->
GetDoc
();
SwDoc
*
pDoc
=
pDocShell
->
GetDoc
();
SwViewShell
*
pViewShell
=
pDoc
->
getIDocumentLayoutAccess
().
GetCurrentViewShell
();
SwViewShell
*
pViewShell
=
pDoc
->
getIDocumentLayoutAccess
().
GetCurrentViewShell
();
pViewShell
->
registerLibreOfficeKitCallback
(
pCallback
,
pData
);
pViewShell
->
registerLibreOfficeKitCallback
(
pCallback
,
pData
);
...
...
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