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
f18d1141
Kaydet (Commit)
f18d1141
authored
Mar 20, 2015
tarafından
Bjoern Michaelsen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
more testcode
Change-Id: I6bce3350385adfa02c0501d98762e16d66f0b490
üst
c5036a67
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
1 deletion
+47
-1
uwriter.cxx
sw/qa/core/uwriter.cxx
+47
-1
No files found.
sw/qa/core/uwriter.cxx
Dosyayı görüntüle @
f18d1141
...
@@ -1390,6 +1390,7 @@ void SwDocTest::testIntrusiveRing()
...
@@ -1390,6 +1390,7 @@ void SwDocTest::testIntrusiveRing()
namespace
namespace
{
{
struct
TestHint
SAL_FINAL
:
SfxHint
{};
struct
TestModify
:
SwModify
struct
TestModify
:
SwModify
{
{
TYPEINFO_OVERRIDE
();
TYPEINFO_OVERRIDE
();
...
@@ -1399,9 +1400,17 @@ namespace
...
@@ -1399,9 +1400,17 @@ namespace
{
{
TYPEINFO_OVERRIDE
();
TYPEINFO_OVERRIDE
();
int
m_nModifyCount
;
int
m_nModifyCount
;
TestClient
()
:
m_nModifyCount
(
0
)
{};
int
m_nNotifyCount
;
TestClient
()
:
m_nModifyCount
(
0
),
m_nNotifyCount
(
0
)
{};
virtual
void
Modify
(
const
SfxPoolItem
*
,
const
SfxPoolItem
*
)
SAL_OVERRIDE
virtual
void
Modify
(
const
SfxPoolItem
*
,
const
SfxPoolItem
*
)
SAL_OVERRIDE
{
++
m_nModifyCount
;
}
{
++
m_nModifyCount
;
}
virtual
void
SwClientNotify
(
const
SwModify
&
rModify
,
const
SfxHint
&
rHint
)
{
if
(
typeid
(
TestHint
)
==
typeid
(
rHint
))
++
m_nNotifyCount
;
else
SwClient
::
SwClientNotify
(
rModify
,
rHint
);
}
};
};
TYPEINIT1
(
TestClient
,
SwClient
);
TYPEINIT1
(
TestClient
,
SwClient
);
// sad copypasta as tools/rtti.hxxs little brain cant cope with templates
// sad copypasta as tools/rtti.hxxs little brain cant cope with templates
...
@@ -1420,16 +1429,35 @@ void SwDocTest::testClientModify()
...
@@ -1420,16 +1429,35 @@ void SwDocTest::testClientModify()
(
void
)
OtherTestClient
();
// avoid loplugin:unreffun
(
void
)
OtherTestClient
();
// avoid loplugin:unreffun
TestModify
aMod
;
TestModify
aMod
;
TestClient
aClient1
,
aClient2
;
TestClient
aClient1
,
aClient2
;
OtherTestClient
aOtherClient1
;
// test client registration
CPPUNIT_ASSERT_EQUAL
(
aClient1
.
GetRegisteredIn
(),
static_cast
<
SwModify
*>
(
nullptr
));
CPPUNIT_ASSERT_EQUAL
(
aClient2
.
GetRegisteredIn
(),
static_cast
<
SwModify
*>
(
nullptr
));
aMod
.
Add
(
&
aClient1
);
aMod
.
Add
(
&
aClient1
);
aMod
.
Add
(
&
aClient2
);
aMod
.
Add
(
&
aClient2
);
CPPUNIT_ASSERT_EQUAL
(
aClient1
.
GetRegisteredIn
(),
static_cast
<
SwModify
*>
(
&
aMod
));
CPPUNIT_ASSERT_EQUAL
(
aClient1
.
GetRegisteredIn
(),
static_cast
<
SwModify
*>
(
&
aMod
));
CPPUNIT_ASSERT_EQUAL
(
aClient2
.
GetRegisteredIn
(),
static_cast
<
SwModify
*>
(
&
aMod
));
CPPUNIT_ASSERT_EQUAL
(
aClient2
.
GetRegisteredIn
(),
static_cast
<
SwModify
*>
(
&
aMod
));
// test broadcast
aMod
.
ModifyBroadcast
(
nullptr
,
nullptr
);
aMod
.
ModifyBroadcast
(
nullptr
,
nullptr
);
CPPUNIT_ASSERT_EQUAL
(
aClient1
.
m_nModifyCount
,
1
);
CPPUNIT_ASSERT_EQUAL
(
aClient1
.
m_nModifyCount
,
1
);
CPPUNIT_ASSERT_EQUAL
(
aClient2
.
m_nModifyCount
,
1
);
CPPUNIT_ASSERT_EQUAL
(
aClient2
.
m_nModifyCount
,
1
);
CPPUNIT_ASSERT_EQUAL
(
aClient1
.
m_nNotifyCount
,
0
);
CPPUNIT_ASSERT_EQUAL
(
aClient2
.
m_nNotifyCount
,
0
);
aMod
.
ModifyBroadcast
(
nullptr
,
nullptr
);
aMod
.
ModifyBroadcast
(
nullptr
,
nullptr
);
CPPUNIT_ASSERT_EQUAL
(
aClient1
.
m_nModifyCount
,
2
);
CPPUNIT_ASSERT_EQUAL
(
aClient1
.
m_nModifyCount
,
2
);
CPPUNIT_ASSERT_EQUAL
(
aClient2
.
m_nModifyCount
,
2
);
CPPUNIT_ASSERT_EQUAL
(
aClient2
.
m_nModifyCount
,
2
);
CPPUNIT_ASSERT_EQUAL
(
aClient1
.
m_nNotifyCount
,
0
);
CPPUNIT_ASSERT_EQUAL
(
aClient2
.
m_nNotifyCount
,
0
);
// test notify
{
TestHint
aHint
;
aMod
.
CallSwClientNotify
(
aHint
);
CPPUNIT_ASSERT_EQUAL
(
aClient1
.
m_nModifyCount
,
2
);
CPPUNIT_ASSERT_EQUAL
(
aClient2
.
m_nModifyCount
,
2
);
CPPUNIT_ASSERT_EQUAL
(
aClient1
.
m_nNotifyCount
,
1
);
CPPUNIT_ASSERT_EQUAL
(
aClient2
.
m_nNotifyCount
,
1
);
}
// test typed iteration
CPPUNIT_ASSERT
(
!
aClient1
.
IsA
(
TYPE
(
OtherTestClient
)));
CPPUNIT_ASSERT
(
!
aClient1
.
IsA
(
TYPE
(
OtherTestClient
)));
{
{
SwIterator
<
OtherTestClient
,
SwModify
>
aIter
(
aMod
);
SwIterator
<
OtherTestClient
,
SwModify
>
aIter
(
aMod
);
...
@@ -1446,8 +1474,24 @@ void SwDocTest::testClientModify()
...
@@ -1446,8 +1474,24 @@ void SwDocTest::testClientModify()
}
}
CPPUNIT_ASSERT_EQUAL
(
nCount
,
2
);
CPPUNIT_ASSERT_EQUAL
(
nCount
,
2
);
}
}
aMod
.
Add
(
&
aOtherClient1
);
CPPUNIT_ASSERT_EQUAL
(
aOtherClient1
.
m_nModifyCount
,
0
);
{
int
nCount
=
0
;
SwIterator
<
TestClient
,
SwModify
>
aIter
(
aMod
);
for
(
TestClient
*
pClient
=
aIter
.
First
();
pClient
;
pClient
=
aIter
.
Next
())
{
CPPUNIT_ASSERT_EQUAL
(
pClient
->
m_nModifyCount
,
2
);
++
nCount
;
}
CPPUNIT_ASSERT_EQUAL
(
nCount
,
2
);
}
CPPUNIT_ASSERT_EQUAL
(
aOtherClient1
.
m_nModifyCount
,
0
);
aMod
.
Remove
(
&
aOtherClient1
);
CPPUNIT_ASSERT_EQUAL
(
aClient1
.
GetRegisteredIn
(),
static_cast
<
SwModify
*>
(
&
aMod
));
CPPUNIT_ASSERT_EQUAL
(
aClient1
.
GetRegisteredIn
(),
static_cast
<
SwModify
*>
(
&
aMod
));
CPPUNIT_ASSERT_EQUAL
(
aClient2
.
GetRegisteredIn
(),
static_cast
<
SwModify
*>
(
&
aMod
));
CPPUNIT_ASSERT_EQUAL
(
aClient2
.
GetRegisteredIn
(),
static_cast
<
SwModify
*>
(
&
aMod
));
CPPUNIT_ASSERT_EQUAL
(
aOtherClient1
.
GetRegisteredIn
(),
static_cast
<
SwModify
*>
(
nullptr
));
// test client self-deregistration during iteration
{
{
int
nCount
=
0
;
int
nCount
=
0
;
SwIterator
<
TestClient
,
SwModify
>
aIter
(
aMod
);
SwIterator
<
TestClient
,
SwModify
>
aIter
(
aMod
);
...
@@ -1472,6 +1516,8 @@ void SwDocTest::testClientModify()
...
@@ -1472,6 +1516,8 @@ void SwDocTest::testClientModify()
aMod
.
ModifyBroadcast
(
nullptr
,
nullptr
);
aMod
.
ModifyBroadcast
(
nullptr
,
nullptr
);
CPPUNIT_ASSERT_EQUAL
(
aClient1
.
m_nModifyCount
,
2
);
CPPUNIT_ASSERT_EQUAL
(
aClient1
.
m_nModifyCount
,
2
);
CPPUNIT_ASSERT_EQUAL
(
aClient2
.
m_nModifyCount
,
2
);
CPPUNIT_ASSERT_EQUAL
(
aClient2
.
m_nModifyCount
,
2
);
CPPUNIT_ASSERT_EQUAL
(
aClient1
.
m_nNotifyCount
,
1
);
CPPUNIT_ASSERT_EQUAL
(
aClient2
.
m_nNotifyCount
,
1
);
}
}
void
SwDocTest
::
setUp
()
void
SwDocTest
::
setUp
()
...
...
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