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
4f4bed9b
Kaydet (Commit)
4f4bed9b
authored
Tem 18, 2013
tarafından
Fridrich Štrba
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Test also the IStream part
Change-Id: If36de8daffb547b07d1417863ccc1a7904b379a5
üst
a25778ab
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
64 additions
and
15 deletions
+64
-15
CppunitTest_shell_zip.mk
shell/CppunitTest_shell_zip.mk
+1
-0
testzipimpl.cxx
shell/qa/zip/testzipimpl.cxx
+1
-4
testzipimpl.hxx
shell/qa/zip/testzipimpl.hxx
+3
-7
ziptest.cxx
shell/qa/zip/ziptest.cxx
+59
-4
No files found.
shell/CppunitTest_shell_zip.mk
Dosyayı görüntüle @
4f4bed9b
...
...
@@ -26,6 +26,7 @@ $(eval $(call gb_CppunitTest_use_externals,zip,\
))
$(eval $(call gb_CppunitTest_use_system_win32_libs,zip, \
ole32 \
kernel32 \
msvcprt \
))
...
...
shell/qa/zip/testzipimpl.cxx
Dosyayı görüntüle @
4f4bed9b
...
...
@@ -17,13 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#define DLLIMPLEMENTATION
#include "testzipimpl.hxx"
vector
<
string
>
expectedContents
;
TestZipImpl
::
TestZipImpl
(
StreamInterface
*
stream
)
:
zipFile
(
ZipFile
(
stream
))
zipFile
(
ZipFile
(
stream
))
,
expectedContents
()
{
expectedContents
.
push_back
(
"mimetype"
);
expectedContents
.
push_back
(
"Configurations2/statusbar/"
);
...
...
shell/qa/zip/testzipimpl.hxx
Dosyayı görüntüle @
4f4bed9b
...
...
@@ -22,20 +22,16 @@
#include <vector>
#include <algorithm>
#include "sal/types.h"
#if defined(DLLIMPLEMENTATION)
#define DLLPUBLIC SAL_DLLPUBLIC_EXPORT
#else
#define DLLPUBLIC SAL_DLLPUBLIC_IMPORT
#endif
using
namespace
std
;
class
DLLPUBLIC
TestZipImpl
class
TestZipImpl
{
private
:
ZipFile
zipFile
;
vector
<
string
>
expectedContents
;
public
:
TestZipImpl
(
StreamInterface
*
stream
);
TestZipImpl
(
StreamInterface
*
stream
);
~
TestZipImpl
();
bool
test_directory
();
bool
test_hasContentCaseInSensitive
();
...
...
shell/qa/zip/ziptest.cxx
Dosyayı görüntüle @
4f4bed9b
...
...
@@ -17,6 +17,16 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#if defined _MSC_VER
#pragma warning(push, 1)
#endif
#include <windows.h>
#if defined _MSC_VER
#pragma warning(pop)
#endif
#include <ole2.h>
#include <stdio.h>
#include "cppunit/TestAssert.h"
#include "cppunit/TestFixture.h"
#include "cppunit/extensions/HelperMacros.h"
...
...
@@ -30,6 +40,7 @@ class Test : public CppUnit::TestFixture
{
private
:
string
documentName
;
LPSTREAM
pStream
;
public
:
Test
();
void
setUp
()
{}
...
...
@@ -37,16 +48,22 @@ public:
void
test_file_directory
();
void
test_file_hasContentCaseInSensitive
();
void
test_file_getContent
();
void
test_stream_directory
();
void
test_stream_hasContentCaseInSensitive
();
void
test_stream_getContent
();
CPPUNIT_TEST_SUITE
(
Test
);
CPPUNIT_TEST
(
test_file_directory
);
CPPUNIT_TEST
(
test_file_hasContentCaseInSensitive
);
CPPUNIT_TEST
(
test_file_getContent
);
CPPUNIT_TEST
(
test_stream_directory
);
CPPUNIT_TEST
(
test_stream_hasContentCaseInSensitive
);
CPPUNIT_TEST
(
test_stream_getContent
);
CPPUNIT_TEST_SUITE_END
();
};
CPPUNIT_TEST_SUITE_REGISTRATION
(
Test
);
Test
::
Test
()
:
documentName
()
Test
::
Test
()
:
documentName
()
,
pStream
(
NULL
)
{
const
char
*
pSrcRoot
=
getenv
(
"SRC_ROOT"
);
if
(
pSrcRoot
)
...
...
@@ -55,6 +72,20 @@ Test::Test() : documentName()
documentName
.
append
(
"/"
);
}
documentName
.
append
(
"shell/qa/zip/simpledocument.odt"
);
// Create an IStream pointer from the file
HANDLE
hFile
=
CreateFileA
(
documentName
.
c_str
(),
GENERIC_READ
,
0
,
NULL
,
OPEN_EXISTING
,
0
,
NULL
);
DWORD
dwFileSize
=
GetFileSize
(
hFile
,
NULL
);
HGLOBAL
hGlobal
=
GlobalAlloc
(
GMEM_MOVEABLE
,
dwFileSize
);
LPVOID
pvData
=
GlobalLock
(
hGlobal
);
DWORD
dwBytesRead
=
0
;
BOOL
bRead
=
ReadFile
(
hFile
,
pvData
,
dwFileSize
,
&
dwBytesRead
,
NULL
);
GlobalUnlock
(
hGlobal
);
CloseHandle
(
hFile
);
HRESULT
hr
=
CreateStreamOnHGlobal
(
hGlobal
,
TRUE
,
&
pStream
);
}
void
Test
::
test_file_directory
()
...
...
@@ -62,7 +93,7 @@ void Test::test_file_directory()
FileStream
stream
(
documentName
.
c_str
());
TestZipImpl
testImpl
(
&
stream
);
bool
isPassed
=
testImpl
.
test_directory
();
CPPUNIT_ASSERT_MESSAGE
(
"Content does not match with expected directory names."
,
isPassed
);
CPPUNIT_ASSERT_MESSAGE
(
"
FileStream:
Content does not match with expected directory names."
,
isPassed
);
}
void
Test
::
test_file_hasContentCaseInSensitive
()
...
...
@@ -70,7 +101,7 @@ void Test::test_file_hasContentCaseInSensitive()
FileStream
stream
(
documentName
.
c_str
());
TestZipImpl
testImpl
(
&
stream
);
bool
isPassed
=
testImpl
.
test_hasContentCaseInSensitive
();
CPPUNIT_ASSERT_MESSAGE
(
"Content in zip file was not found."
,
isPassed
);
CPPUNIT_ASSERT_MESSAGE
(
"
FileStream:
Content in zip file was not found."
,
isPassed
);
}
void
Test
::
test_file_getContent
()
...
...
@@ -78,7 +109,31 @@ void Test::test_file_getContent()
FileStream
stream
(
documentName
.
c_str
());
TestZipImpl
testImpl
(
&
stream
);
bool
isPassed
=
testImpl
.
test_getContent
();
CPPUNIT_ASSERT_MESSAGE
(
"Couldn't receive content buffer form zipfile."
,
isPassed
);
CPPUNIT_ASSERT_MESSAGE
(
"FileStream: Couldn't receive content buffer form zipfile."
,
isPassed
);
}
void
Test
::
test_stream_directory
()
{
BufferStream
stream
(
pStream
);
TestZipImpl
testImpl
(
&
stream
);
bool
isPassed
=
testImpl
.
test_directory
();
CPPUNIT_ASSERT_MESSAGE
(
"BufferStream: Content does not match with expected directory names."
,
isPassed
);
}
void
Test
::
test_stream_hasContentCaseInSensitive
()
{
BufferStream
stream
(
pStream
);
TestZipImpl
testImpl
(
&
stream
);
bool
isPassed
=
testImpl
.
test_hasContentCaseInSensitive
();
CPPUNIT_ASSERT_MESSAGE
(
"BufferStream: Content in zip file was not found."
,
isPassed
);
}
void
Test
::
test_stream_getContent
()
{
BufferStream
stream
(
pStream
);
TestZipImpl
testImpl
(
&
stream
);
bool
isPassed
=
testImpl
.
test_getContent
();
CPPUNIT_ASSERT_MESSAGE
(
"BufferStream: Couldn't receive content buffer form zipfile."
,
isPassed
);
}
CPPUNIT_PLUGIN_IMPLEMENT
();
...
...
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