Merge branch 'release/v7.6.0' into feature/xlsb_write

This commit is contained in:
Viktor Andreev
2023-12-04 20:21:21 +06:00
81 changed files with 5626 additions and 2690 deletions

View File

@ -529,6 +529,14 @@ namespace NExtractTools
nRes = apply_changes(sFrom, sTo, NSDoctRenderer::DoctRendererFormat::FormatFile::DOCT, sDocxFile, params, convertParams);
}
nRes = zip2dir(sDocxFile, sDocxDir);
if (false == SUCCEEDED_X2T(nRes))
{
if (NSDirectory::GetFilesCount(sDocxDir, true) > 3)
{
nRes = 0;
}
}
}
else if (AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCM == nFormatFrom)
{
@ -541,6 +549,13 @@ namespace NExtractTools
{
nRes = zip2dir(sFrom, sDocxDir);
}
if (false == SUCCEEDED_X2T(nRes))
{
if (NSDirectory::GetFilesCount(sDocxDir, true) > 3)
{
nRes = 0;
}
}
}
else if (AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTX == nFormatFrom)
{

View File

@ -1,175 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2023
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "common.h"
#include "../../../DesktopEditor/common/Directory.h"
#include "../../../DesktopEditor/common/Path.h"
#include "../../../OfficeUtils/src/OfficeUtils.h"
#include "../../../DesktopEditor/fontengine/ApplicationFontsWorker.h"
#include "../../../Common/OfficeFileFormatChecker.h"
#include "../../../DesktopEditor/common/StringBuilder.h"
#include "../../src/dylib/x2t.h"
#include "tchar.h"
#include <cstdlib>
#include <locale>
#include <codecvt>
#include <boost/filesystem.hpp>
std::wstring GetWorkDir()
{
std::wstring curDir = NSFile::GetProcessDirectory();
return NSDirectory::CreateDirectoryWithUniqueName(curDir);
}
void RemoveWorkDir(const std::wstring &dir)
{
NSDirectory::DeleteDirectory(dir);
}
int ConvertFile(const std::wstring &fileName)
{
x2tchar* args[2];
args[0] = NULL;
args[1] = (x2tchar*)fileName.c_str();
int nResultCode = X2T_Convert(2, args);
return nResultCode;
}
void PrepareFiles(const std::wstring &fileName, const std::wstring &exampleFileName, const std::wstring &tempDirName)
{
std::wstring sTempUnpackedXLSB = tempDirName + FILE_SEPARATOR_STR + _T("result_unpacked");
NSDirectory::CreateDirectory(sTempUnpackedXLSB);
COfficeUtils oCOfficeUtils(NULL);
_UINT32 nRes = oCOfficeUtils.ExtractToDirectory(fileName, sTempUnpackedXLSB, NULL, 0);
std::wstring sTempUnpackedXLSX = tempDirName + FILE_SEPARATOR_STR + _T("example_unpacked");
NSDirectory::CreateDirectory(sTempUnpackedXLSX);
nRes = oCOfficeUtils.ExtractToDirectory(exampleFileName, sTempUnpackedXLSX, NULL, 0);
}
void CheckFonts(const std::wstring& fontsDir, bool isUseSystem, const std::vector<std::wstring>& addtitionalFontsDirs)
{
CApplicationFontsWorker fonts_worker;
fonts_worker.m_sDirectory = fontsDir;
if (!NSDirectory::Exists(fonts_worker.m_sDirectory))
NSDirectory::CreateDirectory(fonts_worker.m_sDirectory);
fonts_worker.m_bIsUseSystemFonts = isUseSystem;
for (const auto& additional : addtitionalFontsDirs)
{
std::wstring sFolder = additional;
if (0 == sFolder.find(L"."))
sFolder = NSFile::GetProcessDirectory() + FILE_SEPARATOR_STR + sFolder;
fonts_worker.m_arAdditionalFolders.push_back(sFolder);
}
fonts_worker.m_bIsNeedThumbnails = false;
NSFonts::IApplicationFonts* pFonts = fonts_worker.Check();
RELEASEINTERFACE(pFonts);
}
std::wstring CreateParamsFile(const std::wstring &pathFrom, const std::wstring &pathTo, const std::wstring &FontsDir, const std::wstring &TempDir)
{
NSStringUtils::CStringBuilder oBuilder;
oBuilder.WriteString(L"<?xml version=\"1.0\" encoding=\"utf-8\"?>");
oBuilder.WriteString(L"<TaskQueueDataConvert>");
// main
oBuilder.WriteString(L"<m_sFileFrom>");
oBuilder.WriteEncodeXmlString(pathFrom);
oBuilder.WriteString(L"</m_sFileFrom>");
oBuilder.WriteString(L"<m_sFileTo>");
oBuilder.WriteEncodeXmlString(pathTo);
oBuilder.WriteString(L"</m_sFileTo>");
oBuilder.WriteString(L"<m_nFormatTo>");
int nFormat = COfficeFileFormatChecker::GetFormatByExtension(L"." + NSFile::GetFileExtention(pathTo));
oBuilder.WriteString(std::to_wstring(nFormat));
oBuilder.WriteString(L"</m_nFormatTo>");
if (nFormat == AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDFA)
oBuilder.WriteString(L"<m_bIsPDFA>true</m_bIsPDFA>");
oBuilder.WriteString(L"<m_sThemeDir>");
oBuilder.WriteEncodeXmlString(L"/sdkjs/slide/themes");
oBuilder.WriteString(L"</m_sThemeDir>");
// changes
oBuilder.WriteString(L"<m_bFromChanges>false</m_bFromChanges>");
oBuilder.WriteString(L"<m_bDontSaveAdditional>true</m_bDontSaveAdditional>");
// fonts
oBuilder.WriteString(L"<m_sFontDir>");
oBuilder.WriteEncodeXmlString(FontsDir);
oBuilder.WriteString(L"</m_sFontDir>");
oBuilder.WriteString(L"<m_sAllFontsPath>");
oBuilder.WriteString(FontsDir + L"/AllFonts.js");
oBuilder.WriteString(L"</m_sAllFontsPath>");
// temp directory
oBuilder.WriteString(L"<m_sTempDir>");
oBuilder.WriteEncodeXmlString(TempDir);
oBuilder.WriteString(L"</m_sTempDir>");
// txt/csv
oBuilder.WriteString(L"<m_nCsvTxtEncoding>");
oBuilder.WriteEncodeXmlString(L"46");
oBuilder.WriteString(L"</m_nCsvTxtEncoding>");
oBuilder.WriteString(L"<m_nCsvDelimiter>");
oBuilder.WriteEncodeXmlString(L"4");
oBuilder.WriteString(L"</m_nCsvDelimiter>");
oBuilder.WriteString(L"</TaskQueueDataConvert>");
auto xml = TempDir + FILE_SEPARATOR_STR + L"params.xml";
// writing xml data into file
if(NSFile::CFileBinary::Exists(xml))
NSFile::CFileBinary::Remove(xml);
NSFile::CFileBinary xml_file;
xml_file.CreateFile(xml);
xml_file.WriteStringUTF8(oBuilder.GetData());
xml_file.CloseFile();
return xml;
}

View File

@ -1,42 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2023
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "../../../OOXML/Base/Base.h"
#include <string>
#include <vector>
void PrepareFiles(const std::wstring &fileName, const std::wstring &exampleFileName, const std::wstring &tempDirName);
int ConvertFile(const std::wstring &fileName);
std::wstring GetWorkDir();
void RemoveWorkDir(const std::wstring &dir);
std::wstring CreateParamsFile(const std::wstring &pathFrom, const std::wstring &pathTo, const std::wstring &FontsDir, const std::wstring &TempDir);
void CheckFonts(const std::wstring& fontsDir, bool isUseSystem = true, const std::vector<std::wstring>& addtitionalFontsDirs = {});

View File

@ -3,12 +3,175 @@
#include "../../../DesktopEditor/fontengine/ApplicationFontsWorker.h"
#include "../../../Common/OfficeFileFormatChecker.h"
#include "../../src/dylib/x2t.h"
#include "common.h"
#include <gtest/gtest.h>
void CheckFonts(const std::wstring& fontsDir, bool isUseSystem = true, const std::vector<std::wstring>& addtitionalFontsDirs = {})
{
CApplicationFontsWorker fonts_worker;
fonts_worker.m_sDirectory = fontsDir;
if (!NSDirectory::Exists(fonts_worker.m_sDirectory))
NSDirectory::CreateDirectory(fonts_worker.m_sDirectory);
fonts_worker.m_bIsUseSystemFonts = isUseSystem;
for (const auto& additional : addtitionalFontsDirs)
{
std::wstring sFolder = additional;
if (0 == sFolder.find(L"."))
sFolder = NSFile::GetProcessDirectory() + FILE_SEPARATOR_STR + sFolder;
fonts_worker.m_arAdditionalFolders.push_back(sFolder);
}
fonts_worker.m_bIsNeedThumbnails = false;
NSFonts::IApplicationFonts* pFonts = fonts_worker.Check();
RELEASEINTERFACE(pFonts);
}
#define UNUSED_PARAM(x) (void)x
int main(int argc, char** argv)
{
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
{
// warnings
UNUSED_PARAM(argc);
UNUSED_PARAM(argv);
std::wstring curr_dir = NSFile::GetProcessDirectory();
std::wstring wsep = FILE_SEPARATOR_STR;
std::wstring filename_in = curr_dir + wsep + L"123.docx";
std::wstring filename_out = curr_dir + wsep + L"123.pdf";
std::wstring fonts_dir = curr_dir + wsep + L"fonts";
std::wstring xml = curr_dir + wsep + L"params.xml";
std::wstring tmp_dir = NSDirectory::CreateDirectoryWithUniqueName(curr_dir);
CheckFonts(fonts_dir);
// GENERATE XML
NSStringUtils::CStringBuilder oBuilder;
oBuilder.WriteString(L"<?xml version=\"1.0\" encoding=\"utf-8\"?>");
oBuilder.WriteString(L"<TaskQueueDataConvert>");
// main
oBuilder.WriteString(L"<m_sFileFrom>");
oBuilder.WriteEncodeXmlString(filename_in);
oBuilder.WriteString(L"</m_sFileFrom>");
oBuilder.WriteString(L"<m_sFileTo>");
oBuilder.WriteEncodeXmlString(filename_out);
oBuilder.WriteString(L"</m_sFileTo>");
oBuilder.WriteString(L"<m_nFormatTo>");
int nFormat = COfficeFileFormatChecker::GetFormatByExtension(L"." + NSFile::GetFileExtention(filename_out));
oBuilder.WriteString(std::to_wstring(nFormat));
oBuilder.WriteString(L"</m_nFormatTo>");
if (nFormat == AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDFA)
oBuilder.WriteString(L"<m_bIsPDFA>true</m_bIsPDFA>");
oBuilder.WriteString(L"<m_sThemeDir>");
oBuilder.WriteEncodeXmlString(curr_dir + L"/sdkjs/slide/themes");
oBuilder.WriteString(L"</m_sThemeDir>");
// changes
oBuilder.WriteString(L"<m_bFromChanges>false</m_bFromChanges>");
oBuilder.WriteString(L"<m_bDontSaveAdditional>true</m_bDontSaveAdditional>");
// fonts
oBuilder.WriteString(L"<m_sFontDir>");
oBuilder.WriteEncodeXmlString(fonts_dir);
oBuilder.WriteString(L"</m_sFontDir>");
oBuilder.WriteString(L"<m_sAllFontsPath>");
oBuilder.WriteString(fonts_dir + L"/AllFonts.js");
oBuilder.WriteString(L"</m_sAllFontsPath>");
// temp directory
oBuilder.WriteString(L"<m_sTempDir>");
oBuilder.WriteEncodeXmlString(tmp_dir);
oBuilder.WriteString(L"</m_sTempDir>");
// encrypt
if (false)
{
oBuilder.WriteString(L"<m_sPassword>");
oBuilder.WriteEncodeXmlString(L"111");
oBuilder.WriteString(L"</m_sPassword>");
oBuilder.WriteString(L"<m_sSavePassword>");
oBuilder.WriteEncodeXmlString(L"222");
oBuilder.WriteString(L"</m_sSavePassword>");
}
// docinfo (private rooms)
if (false)
{
oBuilder.WriteString(L"<m_sDocumentID>");
oBuilder.WriteEncodeXmlString(L"{data}");
oBuilder.WriteString(L"</m_sDocumentID>");
}
// txt/csv
oBuilder.WriteString(L"<m_nCsvTxtEncoding>");
oBuilder.WriteEncodeXmlString(L"46");
oBuilder.WriteString(L"</m_nCsvTxtEncoding>");
oBuilder.WriteString(L"<m_nCsvDelimiter>");
oBuilder.WriteEncodeXmlString(L"4");
oBuilder.WriteString(L"</m_nCsvDelimiter>");
// js params
if (false)
{
oBuilder.WriteString(L"<m_sJsonParams>");
oBuilder.WriteString(L"{");
// *
oBuilder.WriteString(L"}");
oBuilder.WriteString(L"</m_sJsonParams>");
}
if (false)
{
// if need disable js engine cache
oBuilder.WriteString(L"<m_nDoctParams>1</m_nDoctParams>");
}
// images
if (true && (0 != (nFormat & AVS_OFFICESTUDIO_FILE_IMAGE)))
{
oBuilder.WriteString(L"<m_oThumbnail><first>false</first>");
if (nFormat == AVS_OFFICESTUDIO_FILE_IMAGE_JPG)
oBuilder.WriteString(L"<format>3</format>");
oBuilder.WriteString(L"</m_oThumbnail>");
}
oBuilder.WriteString(L"</TaskQueueDataConvert>");
// writing xml data into file
if(NSFile::CFileBinary::Exists(xml))
NSFile::CFileBinary::Remove(xml);
NSFile::CFileBinary xml_file;
xml_file.CreateFile(xml);
xml_file.WriteStringUTF8(oBuilder.GetData());
xml_file.CloseFile();
#if !defined(_WIN32) && !defined (_WIN64)
std::string xmlDst = U_TO_UTF8(xml);
#else
std::wstring xmlDst = xml;
#endif
x2tchar* args[2];
args[0] = NULL;
args[1] = (x2tchar*)xmlDst.c_str();
int nResultCode = X2T_Convert(2, args);
NSDirectory::DeleteDirectory(tmp_dir);
return nResultCode;
}

View File

@ -7,18 +7,10 @@ DEFINES += BUILD_X2T_AS_LIBRARY_DYLIB
X2T_DIR = $$PWD/../..
include($$X2T_DIR/build/Qt/X2tConverter.pri)
include($$X2T_DIR/../Common/3dParty/googletest/googletest.pri)
HEADERS += $$X2T_DIR/src/dylib/x2t.h
SOURCES += $$X2T_DIR/src/dylib/x2t.cpp
SOURCES += main.cpp\
common.cpp\
../xlsb2xlsx/conversion.cpp
HEADERS += common.h
SOURCES += main.cpp
DESTDIR = $$CORE_BUILDS_BINARY_PATH
SOURCES -= $$CORE_GTEST_PATH/src/gtest_main.cc

View File

@ -1,246 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2023
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "../qmake/common.h"
#include <boost/algorithm/string.hpp>
#include <boost/filesystem.hpp>
#include <fstream>
#include "gtest/gtest.h"
void processTestFile(const std::wstring &tempDir, const std::wstring &testFile, const std::wstring &resultFile, const std::wstring &exampleFile)
{
auto fontsDir = tempDir + FILE_SEPARATOR_STR + L"fonst";
boost::filesystem::path rootPath = std::wstring{L".."} + FILE_SEPARATOR_STR;
rootPath =boost::filesystem::absolute(rootPath.wstring() + rootPath.wstring() + rootPath.wstring()+ rootPath.wstring());
boost::filesystem::path filePath = rootPath.wstring() +L"X2tConverter" + FILE_SEPARATOR_STR + L"test" + FILE_SEPARATOR_STR +L"ExampleFiles"
+ FILE_SEPARATOR_STR + L"xlsb2xlsx" + FILE_SEPARATOR_STR + testFile;
boost::filesystem::path examplePath = rootPath.wstring() +L"X2tConverter" + FILE_SEPARATOR_STR + L"test" + FILE_SEPARATOR_STR +L"ExampleFiles"
+ FILE_SEPARATOR_STR + L"xlsb2xlsx" + FILE_SEPARATOR_STR + exampleFile;
std::wstring resultPath = tempDir + FILE_SEPARATOR_STR + resultFile;
CheckFonts(fontsDir);
auto paramsPath = CreateParamsFile(filePath.wstring(), resultPath, fontsDir, tempDir);
ConvertFile(paramsPath);
PrepareFiles(resultPath, examplePath.wstring(), tempDir);
}
class SimpleTests1 : public ::testing::Test
{
public:
static void SetUpTestCase()
{
tempDir = GetWorkDir();
processTestFile(tempDir, L"simple1.xlsb", L"result.xlsx", L"simple1.xlsx");
}
static void TearDownTestCase()
{
RemoveWorkDir(tempDir);
}
static std::wstring tempDir;
};
class SimpleTests2 : public ::testing::Test
{
public:
static void SetUpTestCase()
{
tempDir = GetWorkDir();
processTestFile(tempDir, L"simple2.xlsb", L"result.xlsx", L"simple2.xlsx");
}
static void TearDownTestCase()
{
RemoveWorkDir(tempDir);
}
static std::wstring tempDir;
};
std::wstring SimpleTests1::tempDir = L"";
std::wstring SimpleTests2::tempDir = L"";
_UINT32 readFiles(const std::wstring &filePath, const std::wstring &examplePath, std::wstring &fileContent, std::wstring &exampleContent )
{
boost::filesystem::path path1(filePath);
boost::filesystem::path path2(examplePath);
path1 = boost::filesystem::absolute(path1);
path2 = boost::filesystem::absolute(path2);
std::ifstream file1(path1.string());
std::ifstream file2(path2.string());
if (!file1.is_open() || !file2.is_open())
{
return 1;
}
fileContent = std::wstring((std::istreambuf_iterator<char>(file1)), std::istreambuf_iterator<char>());
exampleContent = std::wstring((std::istreambuf_iterator<char>(file2)), std::istreambuf_iterator<char>());
return 0;
}
TEST_F(SimpleTests1, ContentTypesTest)
{
auto tempDir = SimpleTests1::tempDir;
std::wstring path1(tempDir + FILE_SEPARATOR_STR + L"result_unpacked"+ FILE_SEPARATOR_STR + L"[Content_Types].xml");
std::wstring path2(tempDir + FILE_SEPARATOR_STR + L"example_unpacked"+ FILE_SEPARATOR_STR + L"[Content_Types].xml");
std::wstring content1;
std::wstring content2;
ASSERT_EQ(readFiles(path1, path2, content1, content2), 0);
ASSERT_TRUE(boost::algorithm::equals(content1, content2));
}
TEST_F(SimpleTests1, WorkbookTest)
{
auto tempDir = SimpleTests1::tempDir;
std::wstring path1(tempDir + FILE_SEPARATOR_STR + L"result_unpacked"+ FILE_SEPARATOR_STR + L"xl" +
FILE_SEPARATOR_STR + L"workbook.xml");
std::wstring path2(tempDir + FILE_SEPARATOR_STR +L"example_unpacked"+ FILE_SEPARATOR_STR + L"xl" +
FILE_SEPARATOR_STR + L"workbook.xml");
std::wstring content1;
std::wstring content2;
ASSERT_EQ(readFiles(path1, path2, content1, content2), 0);
ASSERT_TRUE(boost::algorithm::equals(content1, content2));
}
TEST_F(SimpleTests1, StylesTest)
{
auto tempDir = SimpleTests1::tempDir;
std::wstring path1(tempDir + FILE_SEPARATOR_STR + L"result_unpacked"+ FILE_SEPARATOR_STR + L"xl" +
FILE_SEPARATOR_STR + L"styles.xml");
std::wstring path2(tempDir + FILE_SEPARATOR_STR +L"example_unpacked"+ FILE_SEPARATOR_STR + L"xl" +
FILE_SEPARATOR_STR + L"styles.xml");
std::wstring content1;
std::wstring content2;
ASSERT_EQ(readFiles(path1, path2, content1, content2), 0);
ASSERT_TRUE(boost::algorithm::equals(content1, content2));
}
TEST_F(SimpleTests1, SharedStringsTest)
{
auto tempDir = SimpleTests1::tempDir;
std::wstring path1(tempDir + FILE_SEPARATOR_STR + L"result_unpacked"+ FILE_SEPARATOR_STR + L"xl" +
FILE_SEPARATOR_STR + L"sharedStrings.xml");
std::wstring path2(tempDir + FILE_SEPARATOR_STR +L"example_unpacked"+ FILE_SEPARATOR_STR + L"xl" +
FILE_SEPARATOR_STR + L"sharedStrings.xml");
std::wstring content1;
std::wstring content2;
ASSERT_EQ(readFiles(path1, path2, content1, content2), 0);
ASSERT_TRUE(boost::algorithm::equals(content1, content2));
}
TEST_F(SimpleTests1, WorksheetsTest)
{
auto tempDir = SimpleTests1::tempDir;
std::wstring path1(tempDir + FILE_SEPARATOR_STR + L"result_unpacked"+ FILE_SEPARATOR_STR + L"xl" +
FILE_SEPARATOR_STR + L"worksheets" + FILE_SEPARATOR_STR + L"sheet1.xml");
std::wstring path2(tempDir + FILE_SEPARATOR_STR +L"example_unpacked"+ FILE_SEPARATOR_STR + L"xl" +
FILE_SEPARATOR_STR + L"worksheets" + FILE_SEPARATOR_STR + L"sheet1.xml");
std::wstring content1;
std::wstring content2;
ASSERT_EQ(readFiles(path1, path2, content1, content2), 0);
ASSERT_TRUE(boost::algorithm::equals(content1, content2));
}
TEST_F(SimpleTests2, ContentTypesTest)
{
auto tempDir = SimpleTests2::tempDir;
std::wstring path1(tempDir + FILE_SEPARATOR_STR + L"result_unpacked"+ FILE_SEPARATOR_STR + L"[Content_Types].xml");
std::wstring path2(tempDir + FILE_SEPARATOR_STR + L"example_unpacked"+ FILE_SEPARATOR_STR + L"[Content_Types].xml");
std::wstring content1;
std::wstring content2;
ASSERT_EQ(readFiles(path1, path2, content1, content2), 0);
ASSERT_TRUE(boost::algorithm::equals(content1, content2));
}
TEST_F(SimpleTests2, WorkbookTest)
{
auto tempDir = SimpleTests2::tempDir;
std::wstring path1(tempDir + FILE_SEPARATOR_STR + L"result_unpacked"+ FILE_SEPARATOR_STR + L"xl" +
FILE_SEPARATOR_STR + L"workbook.xml");
std::wstring path2(tempDir + FILE_SEPARATOR_STR +L"example_unpacked"+ FILE_SEPARATOR_STR + L"xl" +
FILE_SEPARATOR_STR + L"workbook.xml");
std::wstring content1;
std::wstring content2;
ASSERT_EQ(readFiles(path1, path2, content1, content2), 0);
ASSERT_TRUE(boost::algorithm::equals(content1, content2));
}
TEST_F(SimpleTests2, StylesTest)
{
auto tempDir = SimpleTests2::tempDir;
std::wstring path1(tempDir + FILE_SEPARATOR_STR + L"result_unpacked"+ FILE_SEPARATOR_STR + L"xl" +
FILE_SEPARATOR_STR + L"styles.xml");
std::wstring path2(tempDir + FILE_SEPARATOR_STR +L"example_unpacked"+ FILE_SEPARATOR_STR + L"xl" +
FILE_SEPARATOR_STR + L"styles.xml");
std::wstring content1;
std::wstring content2;
ASSERT_EQ(readFiles(path1, path2, content1, content2), 0);
ASSERT_TRUE(boost::algorithm::equals(content1, content2));
}
TEST_F(SimpleTests2, SharedStringsTest)
{
auto tempDir = SimpleTests2::tempDir;
std::wstring path1(tempDir + FILE_SEPARATOR_STR + L"result_unpacked"+ FILE_SEPARATOR_STR + L"xl" +
FILE_SEPARATOR_STR + L"sharedStrings.xml");
std::wstring path2(tempDir + FILE_SEPARATOR_STR +L"example_unpacked"+ FILE_SEPARATOR_STR + L"xl" +
FILE_SEPARATOR_STR + L"sharedStrings.xml");
std::wstring content1;
std::wstring content2;
ASSERT_EQ(readFiles(path1, path2, content1, content2), 0);
ASSERT_TRUE(boost::algorithm::equals(content1, content2));
}
TEST_F(SimpleTests2, WorksheetsTest)
{
auto tempDir = SimpleTests2::tempDir;
std::wstring path1(tempDir + FILE_SEPARATOR_STR + L"result_unpacked"+ FILE_SEPARATOR_STR + L"xl" +
FILE_SEPARATOR_STR + L"worksheets" + FILE_SEPARATOR_STR + L"sheet1.xml");
std::wstring path2(tempDir + FILE_SEPARATOR_STR +L"example_unpacked"+ FILE_SEPARATOR_STR + L"xl" +
FILE_SEPARATOR_STR + L"worksheets" + FILE_SEPARATOR_STR + L"sheet1.xml");
std::wstring content1;
std::wstring content2;
ASSERT_EQ(readFiles(path1, path2, content1, content2), 0);
ASSERT_TRUE(boost::algorithm::equals(content1, content2));
}