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
e05cbccc
Kaydet (Commit)
e05cbccc
authored
Mar 22, 2013
tarafından
Markus Mohrhard
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
add export test for color scales
Change-Id: I68ff1309c2769866c0821f7857f13103b8752cb5
üst
6dbea1cc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
151 additions
and
101 deletions
+151
-101
shared_test_impl.hxx
sc/qa/unit/helper/shared_test_impl.hxx
+115
-0
subsequent_export-test.cxx
sc/qa/unit/subsequent_export-test.cxx
+35
-0
subsequent_filters-test.cxx
sc/qa/unit/subsequent_filters-test.cxx
+1
-101
No files found.
sc/qa/unit/helper/shared_test_impl.hxx
0 → 100644
Dosyayı görüntüle @
e05cbccc
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef SC_SHARED_TEST_IMPL_HXX
#define SC_SHARED_TEST_IMPL_HXX
#include "colorscale.hxx"
#include "conditio.hxx"
struct
FindCondFormatByEnclosingRange
{
FindCondFormatByEnclosingRange
(
const
ScRange
&
rRange
)
:
mrRange
(
rRange
)
{}
bool
operator
()(
const
ScConditionalFormat
&
rFormat
)
{
if
(
rFormat
.
GetRange
().
Combine
()
==
mrRange
)
return
true
;
return
false
;
}
private
:
const
ScRange
&
mrRange
;
};
struct
ColorScale2EntryData
{
ScRange
aRange
;
ScColorScaleEntryType
eLowerType
;
ScColorScaleEntryType
eUpperType
;
};
ColorScale2EntryData
aData2Entry
[]
=
{
{
ScRange
(
1
,
2
,
0
,
1
,
5
,
0
),
COLORSCALE_MIN
,
COLORSCALE_MAX
},
{
ScRange
(
3
,
2
,
0
,
3
,
5
,
0
),
COLORSCALE_PERCENTILE
,
COLORSCALE_PERCENT
},
{
ScRange
(
5
,
2
,
0
,
5
,
5
,
0
),
COLORSCALE_VALUE
,
COLORSCALE_FORMULA
}
};
void
testColorScale2Entry_Impl
(
ScDocument
*
pDoc
)
{
const
ScConditionalFormatList
*
pList
=
pDoc
->
GetCondFormList
(
0
);
CPPUNIT_ASSERT
(
pList
);
for
(
size_t
i
=
0
;
i
<
SAL_N_ELEMENTS
(
aData2Entry
);
++
i
)
{
ScConditionalFormatList
::
const_iterator
itr
=
std
::
find_if
(
pList
->
begin
(),
pList
->
end
(),
FindCondFormatByEnclosingRange
(
aData2Entry
[
i
].
aRange
));
CPPUNIT_ASSERT
(
itr
!=
pList
->
end
());
CPPUNIT_ASSERT_EQUAL
(
size_t
(
1
),
itr
->
size
());
const
ScFormatEntry
*
pFormatEntry
=
itr
->
GetEntry
(
0
);
CPPUNIT_ASSERT_EQUAL
(
pFormatEntry
->
GetType
(),
condformat
::
COLORSCALE
);
const
ScColorScaleFormat
*
pColFormat
=
static_cast
<
const
ScColorScaleFormat
*>
(
pFormatEntry
);
CPPUNIT_ASSERT_EQUAL
(
size_t
(
2
),
pColFormat
->
size
());
ScColorScaleFormat
::
const_iterator
format_itr
=
pColFormat
->
begin
();
CPPUNIT_ASSERT_EQUAL
(
aData2Entry
[
i
].
eLowerType
,
format_itr
->
GetType
());
++
format_itr
;
CPPUNIT_ASSERT
(
format_itr
!=
pColFormat
->
end
());
CPPUNIT_ASSERT_EQUAL
(
aData2Entry
[
i
].
eUpperType
,
format_itr
->
GetType
());
}
}
struct
ColorScale3EntryData
{
ScRange
aRange
;
ScColorScaleEntryType
eLowerType
;
ScColorScaleEntryType
eMiddleType
;
ScColorScaleEntryType
eUpperType
;
};
ColorScale3EntryData
aData3Entry
[]
=
{
{
ScRange
(
1
,
1
,
1
,
1
,
6
,
1
),
COLORSCALE_MIN
,
COLORSCALE_PERCENTILE
,
COLORSCALE_MAX
},
{
ScRange
(
3
,
1
,
1
,
3
,
6
,
1
),
COLORSCALE_PERCENTILE
,
COLORSCALE_VALUE
,
COLORSCALE_PERCENT
},
{
ScRange
(
5
,
1
,
1
,
5
,
6
,
1
),
COLORSCALE_VALUE
,
COLORSCALE_VALUE
,
COLORSCALE_FORMULA
}
};
void
testColorScale3Entry_Impl
(
ScDocument
*
pDoc
)
{
ScConditionalFormatList
*
pList
=
pDoc
->
GetCondFormList
(
1
);
CPPUNIT_ASSERT
(
pList
);
for
(
size_t
i
=
0
;
i
<
SAL_N_ELEMENTS
(
aData3Entry
);
++
i
)
{
ScConditionalFormatList
::
const_iterator
itr
=
std
::
find_if
(
pList
->
begin
(),
pList
->
end
(),
FindCondFormatByEnclosingRange
(
aData3Entry
[
i
].
aRange
));
CPPUNIT_ASSERT
(
itr
!=
pList
->
end
());
CPPUNIT_ASSERT_EQUAL
(
size_t
(
1
),
itr
->
size
());
const
ScFormatEntry
*
pFormatEntry
=
itr
->
GetEntry
(
0
);
CPPUNIT_ASSERT_EQUAL
(
pFormatEntry
->
GetType
(),
condformat
::
COLORSCALE
);
const
ScColorScaleFormat
*
pColFormat
=
static_cast
<
const
ScColorScaleFormat
*>
(
pFormatEntry
);
CPPUNIT_ASSERT_EQUAL
(
size_t
(
3
),
pColFormat
->
size
());
ScColorScaleFormat
::
const_iterator
format_itr
=
pColFormat
->
begin
();
CPPUNIT_ASSERT_EQUAL
(
aData3Entry
[
i
].
eLowerType
,
format_itr
->
GetType
());
++
format_itr
;
CPPUNIT_ASSERT
(
format_itr
!=
pColFormat
->
end
());
CPPUNIT_ASSERT_EQUAL
(
aData3Entry
[
i
].
eMiddleType
,
format_itr
->
GetType
());
++
format_itr
;
CPPUNIT_ASSERT
(
format_itr
!=
pColFormat
->
end
());
CPPUNIT_ASSERT_EQUAL
(
aData3Entry
[
i
].
eUpperType
,
format_itr
->
GetType
());
}
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sc/qa/unit/subsequent_export-test.cxx
Dosyayı görüntüle @
e05cbccc
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
#define CALC_DEBUG_OUTPUT 0
#define CALC_DEBUG_OUTPUT 0
#include "helper/qahelper.hxx"
#include "helper/qahelper.hxx"
#include "helper/shared_test_impl.hxx"
#include "docsh.hxx"
#include "docsh.hxx"
#include "postit.hxx"
#include "postit.hxx"
...
@@ -45,6 +46,8 @@ public:
...
@@ -45,6 +46,8 @@ public:
void
test
();
void
test
();
void
testPasswordExport
();
void
testPasswordExport
();
void
testConditionalFormatExportXLSX
();
void
testConditionalFormatExportXLSX
();
void
testColorScaleExportODS
();
void
testColorScaleExportXLSX
();
void
testMiscRowHeightExport
();
void
testMiscRowHeightExport
();
CPPUNIT_TEST_SUITE
(
ScExportTest
);
CPPUNIT_TEST_SUITE
(
ScExportTest
);
...
@@ -53,6 +56,8 @@ public:
...
@@ -53,6 +56,8 @@ public:
CPPUNIT_TEST
(
testPasswordExport
);
CPPUNIT_TEST
(
testPasswordExport
);
#endif
#endif
CPPUNIT_TEST
(
testConditionalFormatExportXLSX
);
CPPUNIT_TEST
(
testConditionalFormatExportXLSX
);
CPPUNIT_TEST
(
testColorScaleExportODS
);
CPPUNIT_TEST
(
testColorScaleExportXLSX
);
CPPUNIT_TEST
(
testMiscRowHeightExport
);
CPPUNIT_TEST
(
testMiscRowHeightExport
);
CPPUNIT_TEST_SUITE_END
();
CPPUNIT_TEST_SUITE_END
();
...
@@ -157,6 +162,36 @@ void ScExportTest::testConditionalFormatExportXLSX()
...
@@ -157,6 +162,36 @@ void ScExportTest::testConditionalFormatExportXLSX()
testCondFile
(
aCSVPath
,
pDoc
,
0
);
testCondFile
(
aCSVPath
,
pDoc
,
0
);
}
}
void
ScExportTest
::
testColorScaleExportODS
()
{
ScDocShellRef
xShell
=
loadDoc
(
"colorscale."
,
ODS
);
CPPUNIT_ASSERT
(
xShell
.
Is
());
ScDocShellRef
xDocSh
=
saveAndReload
(
xShell
,
ODS
);
CPPUNIT_ASSERT
(
xDocSh
.
Is
());
ScDocument
*
pDoc
=
xDocSh
->
GetDocument
();
CPPUNIT_ASSERT
(
pDoc
);
testColorScale2Entry_Impl
(
pDoc
);
testColorScale3Entry_Impl
(
pDoc
);
}
void
ScExportTest
::
testColorScaleExportXLSX
()
{
ScDocShellRef
xShell
=
loadDoc
(
"colorscale."
,
XLSX
);
CPPUNIT_ASSERT
(
xShell
.
Is
());
ScDocShellRef
xDocSh
=
saveAndReload
(
xShell
,
XLSX
);
CPPUNIT_ASSERT
(
xDocSh
.
Is
());
ScDocument
*
pDoc
=
xDocSh
->
GetDocument
();
CPPUNIT_ASSERT
(
pDoc
);
testColorScale2Entry_Impl
(
pDoc
);
testColorScale3Entry_Impl
(
pDoc
);
}
void
ScExportTest
::
testMiscRowHeightExport
()
void
ScExportTest
::
testMiscRowHeightExport
()
{
{
TestParam
::
RowData
DfltRowData
[]
=
TestParam
::
RowData
DfltRowData
[]
=
...
...
sc/qa/unit/subsequent_filters-test.cxx
Dosyayı görüntüle @
e05cbccc
...
@@ -75,6 +75,7 @@
...
@@ -75,6 +75,7 @@
#define TEST_BUG_FILES 0
#define TEST_BUG_FILES 0
#include "helper/qahelper.hxx"
#include "helper/qahelper.hxx"
#include "helper/shared_test_impl.hxx"
using
namespace
::
com
::
sun
::
star
;
using
namespace
::
com
::
sun
::
star
;
using
namespace
::
com
::
sun
::
star
::
uno
;
using
namespace
::
com
::
sun
::
star
::
uno
;
...
@@ -1733,23 +1734,6 @@ void ScFiltersTest::testRichTextContentODS()
...
@@ -1733,23 +1734,6 @@ void ScFiltersTest::testRichTextContentODS()
namespace
{
namespace
{
struct
FindCondFormatByEnclosingRange
{
FindCondFormatByEnclosingRange
(
const
ScRange
&
rRange
)
:
mrRange
(
rRange
)
{}
bool
operator
()(
const
ScConditionalFormat
&
rFormat
)
{
if
(
rFormat
.
GetRange
().
Combine
()
==
mrRange
)
return
true
;
return
false
;
}
private
:
const
ScRange
&
mrRange
;
};
struct
DataBarData
struct
DataBarData
{
{
ScRange
aRange
;
ScRange
aRange
;
...
@@ -1812,90 +1796,6 @@ void ScFiltersTest::testDataBarXLSX()
...
@@ -1812,90 +1796,6 @@ void ScFiltersTest::testDataBarXLSX()
testDataBar_Impl
(
pDoc
);
testDataBar_Impl
(
pDoc
);
}
}
namespace
{
struct
ColorScale2EntryData
{
ScRange
aRange
;
ScColorScaleEntryType
eLowerType
;
ScColorScaleEntryType
eUpperType
;
};
ColorScale2EntryData
aData2Entry
[]
=
{
{
ScRange
(
1
,
2
,
0
,
1
,
5
,
0
),
COLORSCALE_MIN
,
COLORSCALE_MAX
},
{
ScRange
(
3
,
2
,
0
,
3
,
5
,
0
),
COLORSCALE_PERCENTILE
,
COLORSCALE_PERCENT
},
{
ScRange
(
5
,
2
,
0
,
5
,
5
,
0
),
COLORSCALE_VALUE
,
COLORSCALE_FORMULA
}
};
void
testColorScale2Entry_Impl
(
ScDocument
*
pDoc
)
{
const
ScConditionalFormatList
*
pList
=
pDoc
->
GetCondFormList
(
0
);
CPPUNIT_ASSERT
(
pList
);
for
(
size_t
i
=
0
;
i
<
SAL_N_ELEMENTS
(
aData2Entry
);
++
i
)
{
ScConditionalFormatList
::
const_iterator
itr
=
std
::
find_if
(
pList
->
begin
(),
pList
->
end
(),
FindCondFormatByEnclosingRange
(
aData2Entry
[
i
].
aRange
));
CPPUNIT_ASSERT
(
itr
!=
pList
->
end
());
CPPUNIT_ASSERT_EQUAL
(
size_t
(
1
),
itr
->
size
());
const
ScFormatEntry
*
pFormatEntry
=
itr
->
GetEntry
(
0
);
CPPUNIT_ASSERT_EQUAL
(
pFormatEntry
->
GetType
(),
condformat
::
COLORSCALE
);
const
ScColorScaleFormat
*
pColFormat
=
static_cast
<
const
ScColorScaleFormat
*>
(
pFormatEntry
);
CPPUNIT_ASSERT_EQUAL
(
size_t
(
2
),
pColFormat
->
size
());
ScColorScaleFormat
::
const_iterator
format_itr
=
pColFormat
->
begin
();
CPPUNIT_ASSERT_EQUAL
(
aData2Entry
[
i
].
eLowerType
,
format_itr
->
GetType
());
++
format_itr
;
CPPUNIT_ASSERT
(
format_itr
!=
pColFormat
->
end
());
CPPUNIT_ASSERT_EQUAL
(
aData2Entry
[
i
].
eUpperType
,
format_itr
->
GetType
());
}
}
struct
ColorScale3EntryData
{
ScRange
aRange
;
ScColorScaleEntryType
eLowerType
;
ScColorScaleEntryType
eMiddleType
;
ScColorScaleEntryType
eUpperType
;
};
ColorScale3EntryData
aData3Entry
[]
=
{
{
ScRange
(
1
,
1
,
1
,
1
,
6
,
1
),
COLORSCALE_MIN
,
COLORSCALE_PERCENTILE
,
COLORSCALE_MAX
},
{
ScRange
(
3
,
1
,
1
,
3
,
6
,
1
),
COLORSCALE_PERCENTILE
,
COLORSCALE_VALUE
,
COLORSCALE_PERCENT
},
{
ScRange
(
5
,
1
,
1
,
5
,
6
,
1
),
COLORSCALE_VALUE
,
COLORSCALE_VALUE
,
COLORSCALE_FORMULA
}
};
void
testColorScale3Entry_Impl
(
ScDocument
*
pDoc
)
{
ScConditionalFormatList
*
pList
=
pDoc
->
GetCondFormList
(
1
);
CPPUNIT_ASSERT
(
pList
);
for
(
size_t
i
=
0
;
i
<
SAL_N_ELEMENTS
(
aData3Entry
);
++
i
)
{
ScConditionalFormatList
::
const_iterator
itr
=
std
::
find_if
(
pList
->
begin
(),
pList
->
end
(),
FindCondFormatByEnclosingRange
(
aData3Entry
[
i
].
aRange
));
CPPUNIT_ASSERT
(
itr
!=
pList
->
end
());
CPPUNIT_ASSERT_EQUAL
(
size_t
(
1
),
itr
->
size
());
const
ScFormatEntry
*
pFormatEntry
=
itr
->
GetEntry
(
0
);
CPPUNIT_ASSERT_EQUAL
(
pFormatEntry
->
GetType
(),
condformat
::
COLORSCALE
);
const
ScColorScaleFormat
*
pColFormat
=
static_cast
<
const
ScColorScaleFormat
*>
(
pFormatEntry
);
CPPUNIT_ASSERT_EQUAL
(
size_t
(
3
),
pColFormat
->
size
());
ScColorScaleFormat
::
const_iterator
format_itr
=
pColFormat
->
begin
();
CPPUNIT_ASSERT_EQUAL
(
aData3Entry
[
i
].
eLowerType
,
format_itr
->
GetType
());
++
format_itr
;
CPPUNIT_ASSERT
(
format_itr
!=
pColFormat
->
end
());
CPPUNIT_ASSERT_EQUAL
(
aData3Entry
[
i
].
eMiddleType
,
format_itr
->
GetType
());
++
format_itr
;
CPPUNIT_ASSERT
(
format_itr
!=
pColFormat
->
end
());
CPPUNIT_ASSERT_EQUAL
(
aData3Entry
[
i
].
eUpperType
,
format_itr
->
GetType
());
}
}
}
void
ScFiltersTest
::
testColorScaleODS
()
void
ScFiltersTest
::
testColorScaleODS
()
{
{
ScDocShellRef
xDocSh
=
loadDoc
(
"colorscale."
,
ODS
);
ScDocShellRef
xDocSh
=
loadDoc
(
"colorscale."
,
ODS
);
...
...
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