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
c9f30fa2
Kaydet (Commit)
c9f30fa2
authored
Nis 14, 2012
tarafından
Michael Meeks
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
writer redlining unit test starts to do something useful
üst
a6ad8e8f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
55 deletions
+28
-55
swcrsr.hxx
sw/inc/swcrsr.hxx
+1
-1
swdoc-test.cxx
sw/qa/core/swdoc-test.cxx
+27
-54
No files found.
sw/inc/swcrsr.hxx
Dosyayı görüntüle @
c9f30fa2
...
@@ -67,7 +67,7 @@ namespace nsSwCursorSelOverFlags
...
@@ -67,7 +67,7 @@ namespace nsSwCursorSelOverFlags
const
SwCursorSelOverFlags
SELOVER_CHANGEPOS
=
0x08
;
const
SwCursorSelOverFlags
SELOVER_CHANGEPOS
=
0x08
;
}
}
class
SwCursor
:
public
SwPaM
class
S
W_DLLPUBLIC
S
wCursor
:
public
SwPaM
{
{
friend
class
SwCrsrSaveState
;
friend
class
SwCrsrSaveState
;
...
...
sw/qa/core/swdoc-test.cxx
Dosyayı görüntüle @
c9f30fa2
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
#include <sal/config.h>
#include <sal/config.h>
#include <test/bootstrapfixture.hxx>
#include <test/bootstrapfixture.hxx>
#include <rtl/strbuf.hxx>
#include <osl/file.hxx>
#include <osl/file.hxx>
#include <tools/urlobj.hxx>
#include <tools/urlobj.hxx>
...
@@ -414,26 +415,26 @@ getRandString()
...
@@ -414,26 +415,26 @@ getRandString()
return
aRet
;
return
aRet
;
}
}
#ifdef COMPLEX
static
SwPosition
static
SwPosition
getRandomPosition
(
SwDoc
*
pDoc
,
int
nOffset
)
getRandomPosition
(
SwDoc
*
pDoc
,
int
/* nOffset */
)
{
{
SwPaM
aPam
(
pDoc
->
GetNodes
());
const
SwPosition
aPos
(
pDoc
->
GetNodes
().
GetEndOfContent
());
SwCursor
aCrs
(
*
aPam
.
Start
(),
0
,
false
);
sal_uLong
nNodes
=
aPos
.
nNode
.
GetNode
().
GetIndex
()
-
aPos
.
nNode
.
GetNode
().
StartOfSectionIndex
();
for
(
int
sskip
=
getRand
(
nOffset
);
sskip
>
0
;
sskip
--
)
sal_uLong
n
=
(
rand
()
*
nNodes
)
/
RAND_MAX
;
aCrs
.
GoNextSentence
();
SwPaM
pam
(
aPos
);
aCrs
.
GoNextCell
(
getRand
(
50
));
for
(
sal_uLong
i
=
0
;
i
<
n
;
++
i
)
{
return
*
aCrs
.
GetPoint
();
pam
.
Move
(
fnMoveBackward
,
fnGoNode
);
}
return
*
pam
.
GetPoint
();
}
}
#endif
void
SwDocTest
::
randomTest
()
void
SwDocTest
::
randomTest
()
{
{
CPPUNIT_ASSERT_MESSAGE
(
"SwDoc::IsRedlineOn()"
,
!
m_pDoc
->
IsRedlineOn
());
CPPUNIT_ASSERT_MESSAGE
(
"SwDoc::IsRedlineOn()"
,
!
m_pDoc
->
IsRedlineOn
());
RedlineMode_t
modes
[]
=
{
RedlineMode_t
modes
[]
=
{
nsRedlineMode_t
::
REDLINE_NONE
,
nsRedlineMode_t
::
REDLINE_ON
,
nsRedlineMode_t
::
REDLINE_ON
,
nsRedlineMode_t
::
REDLINE_SHOW_MASK
,
nsRedlineMode_t
::
REDLINE_SHOW_MASK
,
nsRedlineMode_t
::
REDLINE_NONE
,
nsRedlineMode_t
::
REDLINE_ON
|
nsRedlineMode_t
::
REDLINE_SHOW_MASK
,
nsRedlineMode_t
::
REDLINE_ON
|
nsRedlineMode_t
::
REDLINE_SHOW_MASK
,
nsRedlineMode_t
::
REDLINE_ON
|
nsRedlineMode_t
::
REDLINE_IGNORE
,
nsRedlineMode_t
::
REDLINE_ON
|
nsRedlineMode_t
::
REDLINE_IGNORE
,
nsRedlineMode_t
::
REDLINE_ON
|
nsRedlineMode_t
::
REDLINE_IGNORE
|
nsRedlineMode_t
::
REDLINE_SHOW_MASK
,
nsRedlineMode_t
::
REDLINE_ON
|
nsRedlineMode_t
::
REDLINE_IGNORE
|
nsRedlineMode_t
::
REDLINE_SHOW_MASK
,
...
@@ -444,38 +445,26 @@ void SwDocTest::randomTest()
...
@@ -444,38 +445,26 @@ void SwDocTest::randomTest()
"Jim"
,
"Bob"
,
"JimBobina"
,
"Helga"
,
"Gertrude"
,
"Spagna"
,
"Hurtleweed"
"Jim"
,
"Bob"
,
"JimBobina"
,
"Helga"
,
"Gertrude"
,
"Spagna"
,
"Hurtleweed"
};
};
for
(
sal_uInt16
rlm
=
0
;
for
(
sal_uInt16
rlm
=
0
;
rlm
<
SAL_N_ELEMENTS
(
modes
);
rlm
++
)
rlm
<
SAL_N_ELEMENTS
(
modes
);
#ifdef COMPLEX // otherwise it returns at end of loop, so avoid "unreachable code" warning
rlm
++
#endif
)
{
{
#ifdef COMPLEX
m_pDoc
->
ClearDoc
();
m_pDoc
->
ClearDoc
();
// setup redlining
// setup redlining
m_pDoc
->
SetRedlineMode
(
modes
[
rlm
]);
m_pDoc
->
SetRedlineMode
(
modes
[
rlm
]);
SW_MOD
()
->
SetRedlineAuthor
(
rtl
::
OUString
::
createFromAscii
(
authors
[
0
]));
SW_MOD
()
->
SetRedlineAuthor
(
rtl
::
OUString
::
createFromAscii
(
authors
[
0
]));
#endif
for
(
int
i
=
0
;
i
<
2000
;
i
++
)
for
(
int
i
=
0
;
i
<
2000
;
i
++
)
{
{
#ifdef COMPLEX
SwPaM
aPam
(
m_pDoc
->
GetNodes
());
SwPaM
aPam
(
m_pDoc
->
GetNodes
());
SwCursor
aCrs
(
getRandomPosition
(
m_pDoc
,
i
/
20
),
0
,
false
);
SwCursor
aCrs
(
getRandomPosition
(
m_pDoc
,
i
/
20
),
0
,
false
);
aCrs
.
SetMark
();
aCrs
.
SetMark
();
aCrs
.
GoNextCell
(
getRand
(
30
));
#else // simple:
SwNodeIndex
nNode
(
m_pDoc
->
GetNodes
().
GetEndOfContent
(),
-
1
);
SwPaM
aCrs
(
nNode
);
#endif
switch
(
getRand
(
i
<
50
?
3
:
6
))
{
switch
(
getRand
(
i
<
50
?
3
:
6
))
{
// insert ops first
// insert ops first
case
0
:
{
case
0
:
{
if
(
!
m_pDoc
->
InsertString
(
aCrs
,
getRandString
()))
if
(
!
m_pDoc
->
InsertString
(
aCrs
,
getRandString
()))
{
fprintf
(
stderr
,
"failed to insert string !
\n
"
);
// fprintf (stderr, "failed to insert string !\n");
}
break
;
break
;
}
}
case
1
:
case
1
:
...
@@ -486,7 +475,6 @@ void SwDocTest::randomTest()
...
@@ -486,7 +475,6 @@ void SwDocTest::randomTest()
break
;
break
;
}
}
#ifdef COMPLEX
// movement / deletion ops later
// movement / deletion ops later
case
3
:
// deletion
case
3
:
// deletion
switch
(
getRand
(
6
))
{
switch
(
getRand
(
6
))
{
...
@@ -518,7 +506,7 @@ void SwDocTest::randomTest()
...
@@ -518,7 +506,7 @@ void SwDocTest::randomTest()
m_pDoc
->
MoveRange
(
aCrs
,
aTo
,
nFlags
);
m_pDoc
->
MoveRange
(
aCrs
,
aTo
,
nFlags
);
break
;
break
;
}
}
#endif
case
5
:
case
5
:
break
;
break
;
...
@@ -526,35 +514,20 @@ void SwDocTest::randomTest()
...
@@ -526,35 +514,20 @@ void SwDocTest::randomTest()
default
:
default
:
break
;
break
;
}
}
#ifdef COMPLEX
SwPosition
start
(
m_pDoc
->
GetNodes
());
SwPosition
end
(
m_pDoc
->
GetNodes
().
GetEndOfContent
());
CheckNodesRange
(
start
.
nNode
,
end
.
nNode
,
sal_True
);
#endif
}
}
// Debug / verify the produced document has real content
#if 0
#if 0
fprintf (stderr, "write it !\n");
rtl::OStringBuffer aBuffer("nodes-");
#ifdef COMPLEX
aBuffer.append(sal_Int32(rlm));
SfxFilter aFilter(rtl::OUString::createFromAscii("writer8"),
aBuffer.append(".xml");
rtl::OUString(), 0, 0, rtl::OUString(), 0, rtl::OUString(),
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CXML")),
xmlTextWriterPtr writer;
rtl::OUString() );
writer = xmlNewTextWriterFilename( aBuffer.makeStringAndClear().getStr(), 0 );
#else
xmlTextWriterStartDocument( writer, NULL, NULL, NULL );
SfxFilter aFilter(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Text")),
m_pDoc->dumpAsXml(writer);
rtl::OUString(), 0, 0, rtl::OUString(), 0, rtl::OUString(),
xmlTextWriterEndDocument( writer );
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TEXT")), rtl::OUString() );
xmlFreeTextWriter( writer );
#endif
SfxMedium
aDstMed
(
rtl
::
OUString
(
RTL_CONSTASCII_USTRINGPARAM
(
"file:///tmp/test.txt"
)),
STREAM_STD_READWRITE
,
true
);
aDstMed
.
SetFilter
(
&
aFilter
);
m_xDocShRef
->
DoSaveAs
(
aDstMed
);
m_xDocShRef
->
DoSaveCompleted
(
&
aDstMed
);
m_xDocShRef
->
DoInitNew
(
0
);
#endif
#ifndef COMPLEX
return
;
#endif
#endif
}
}
}
}
...
...
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