diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index 68861113..45d8585c 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -8,19 +8,25 @@ if(NOT COMBINED_PROJECT) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../source ${CMAKE_CURRENT_BINARY_DIR}/source) endif() -include_directories(${LIBRARY_INCLUDE_DIR}) +set(XLNT_BENCHMARK_DATA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/data) -file(GLOB SAMPLE_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) +file(GLOB BENCHMARK_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) -foreach(SAMPLE_SOURCE IN ITEMS ${SAMPLE_SOURCES}) - get_filename_component(SAMPLE_NAME ${SAMPLE_SOURCE} NAME_WE) - set(SAMPLE_EXECUTABLE benchmark-${SAMPLE_NAME}) - add_executable(${SAMPLE_EXECUTABLE} ${SAMPLE_SOURCE}) - target_link_libraries(${SAMPLE_EXECUTABLE} PRIVATE xlnt) - if(NOT STATIC) - add_custom_command(TARGET ${SAMPLE_EXECUTABLE} POST_BUILD +foreach(BENCHMARK_SOURCE IN ITEMS ${BENCHMARK_SOURCES}) + get_filename_component(BENCHMARK_NAME ${BENCHMARK_SOURCE} NAME_WE) + set(BENCHMARK_EXECUTABLE benchmark-${BENCHMARK_NAME}) + + add_executable(${BENCHMARK_EXECUTABLE} ${BENCHMARK_SOURCE}) + + target_link_libraries(${BENCHMARK_EXECUTABLE} PRIVATE xlnt) + target_include_directories(${BENCHMARK_EXECUTABLE} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../tests) + target_compile_definitions(${BENCHMARK_EXECUTABLE} PRIVATE XLNT_BENCHMARK_DATA_DIR=${XLNT_BENCHMARK_DATA_DIR}) + + if(MSVC AND NOT STATIC) + add_custom_command(TARGET ${BENCHMARK_EXECUTABLE} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $ - $) + $) endif() endforeach() diff --git a/benchmarks/styles.cpp b/benchmarks/styles.cpp index 6955c1ef..35073f85 100644 --- a/benchmarks/styles.cpp +++ b/benchmarks/styles.cpp @@ -1,13 +1,35 @@ +// Copyright (c) 2017 Thomas Fussell +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE +// +// @license: http://www.opensource.org/licenses/mit-license.php +// @author: see AUTHORS file + #include #include #include #include + +#include #include -std::size_t current_time() -{ - return static_cast(std::chrono::duration(std::chrono::system_clock::now().time_since_epoch()).count()); -} +namespace { std::size_t random_index(std::size_t max) { @@ -23,28 +45,70 @@ std::vector generate_all_styles(xlnt::workbook &wb) { std::vector styles; - std::vector vertical_alignments = {xlnt::vertical_alignment::center, xlnt::vertical_alignment::justify, xlnt::vertical_alignment::top, xlnt::vertical_alignment::bottom}; - std::vector horizontal_alignments = {xlnt::horizontal_alignment::center, xlnt::horizontal_alignment::center_continuous, xlnt::horizontal_alignment::general, xlnt::horizontal_alignment::justify, xlnt::horizontal_alignment::left, xlnt::horizontal_alignment::right}; - std::vector font_names = {"Calibri", "Tahoma", "Arial", "Times New Roman"}; - std::vector font_sizes = {11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35}; - std::vector bold_options = {true, false}; - std::vector underline_options = {xlnt::font::underline_style::single, xlnt::font::underline_style::none}; - std::vector italic_options = {true, false}; - std::size_t index = 0; - - for(auto vertical_alignment : vertical_alignments) + const auto vertical_alignments = std::vector { - for(auto horizontal_alignment : horizontal_alignments) + xlnt::vertical_alignment::center, + xlnt::vertical_alignment::justify, + xlnt::vertical_alignment::top, + xlnt::vertical_alignment::bottom + }; + + const auto horizontal_alignments = std::vector + { + xlnt::horizontal_alignment::center, + xlnt::horizontal_alignment::center_continuous, + xlnt::horizontal_alignment::general, + xlnt::horizontal_alignment::justify, + xlnt::horizontal_alignment::left, + xlnt::horizontal_alignment::right + }; + + const auto font_names = std::vector + { + "Calibri", + "Tahoma", + "Arial", + "Times New Roman" + }; + + const auto font_sizes = std::vector + { + 11., + 13., + 15., + 17., + 19., + 21., + 23., + 25., + 27., + 29., + 31., + 33., + 35. + }; + + const auto underline_options = std::vector + { + xlnt::font::underline_style::single, + xlnt::font::underline_style::none + }; + + std::size_t index = 0; + + for (auto vertical_alignment : vertical_alignments) + { + for (auto horizontal_alignment : horizontal_alignments) { - for(auto name : font_names) + for (auto name : font_names) { - for(auto size : font_sizes) + for (auto size : font_sizes) { - for(auto bold : bold_options) + for (auto bold : { true, false }) { - for(auto underline : underline_options) + for (auto underline : underline_options) { - for(auto italic : italic_options) + for (auto italic : { true, false }) { auto s = wb.create_style(std::to_string(index++)); @@ -91,12 +155,17 @@ xlnt::workbook non_optimized_workbook(int n) void to_profile(xlnt::workbook &wb, const std::string &f, int n) { + using xlnt::benchmarks::current_time; + auto start = current_time(); wb.save(f); auto elapsed = current_time() - start; + std::cout << "took " << elapsed / 1000.0 << "s for " << n << " styles" << std::endl; } +} // namespace + int main() { int n = 10000; diff --git a/benchmarks/writer.cpp b/benchmarks/writer.cpp index 40655449..c6a7976f 100644 --- a/benchmarks/writer.cpp +++ b/benchmarks/writer.cpp @@ -1,11 +1,33 @@ +// Copyright (c) 2017 Thomas Fussell +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE +// +// @license: http://www.opensource.org/licenses/mit-license.php +// @author: see AUTHORS file + #include #include + +#include #include -std::size_t current_time() -{ - return static_cast(std::chrono::duration(std::chrono::system_clock::now().time_since_epoch()).count()); -} +namespace { // Create a worksheet with variable width rows. Because data must be // serialised row by row it is often the width of the rows which is most @@ -32,7 +54,7 @@ void writer(int cols, int rows) std::cout << std::endl; - auto filename = "data/benchmark.xlsx"; + auto filename = "benchmark.xlsx"; wb.save(filename); } @@ -41,6 +63,8 @@ void writer(int cols, int rows) // Time from the best of three is taken. void timer(std::function fn, int cols, int rows) { + using xlnt::benchmarks::current_time; + const auto repeat = std::size_t(3); auto time = std::numeric_limits::max(); @@ -56,6 +80,8 @@ void timer(std::function fn, int cols, int rows) std::cout << time / 1000.0 << std::endl; } +} // namespace + int main() { timer(&writer, 100, 100); diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt index b59006c1..d728283e 100644 --- a/samples/CMakeLists.txt +++ b/samples/CMakeLists.txt @@ -8,14 +8,22 @@ if(NOT COMBINED_PROJECT) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../source ${CMAKE_CURRENT_BINARY_DIR}/source) endif() +set(XLNT_SAMPLE_DATA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/data) + file(GLOB SAMPLE_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) foreach(SAMPLE_SOURCE IN ITEMS ${SAMPLE_SOURCES}) get_filename_component(SAMPLE_NAME ${SAMPLE_SOURCE} NAME_WE) set(SAMPLE_EXECUTABLE sample-${SAMPLE_NAME}) + add_executable(${SAMPLE_EXECUTABLE} ${SAMPLE_SOURCE}) + target_link_libraries(${SAMPLE_EXECUTABLE} PRIVATE xlnt) - if(NOT STATIC) + target_include_directories(${SAMPLE_EXECUTABLE} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../tests) + target_compile_definitions(${SAMPLE_EXECUTABLE} PRIVATE XLNT_SAMPLE_DATA_DIR=${XLNT_SAMPLE_DATA_DIR}) + + if(MSVC AND NOT STATIC) add_custom_command(TARGET ${SAMPLE_EXECUTABLE} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $ diff --git a/samples/decrypt.cpp b/samples/decrypt.cpp index 34af3a21..b87284a7 100644 --- a/samples/decrypt.cpp +++ b/samples/decrypt.cpp @@ -1,3 +1,27 @@ +// Copyright (c) 2017 Thomas Fussell +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE +// +// @license: http://www.opensource.org/licenses/mit-license.php +// @author: see AUTHORS file + +#include #include int main() @@ -5,8 +29,8 @@ int main() xlnt::workbook wb; const auto password = std::string("secret"); - wb.load("data/encrypted.xlsx", password); - wb.save("data/decrypted.xlsx"); + wb.load(path_helper::sample_file("encrypted.xlsx"), password); + wb.save("decrypted.xlsx"); return 0; } diff --git a/samples/img2xlsx.cpp b/samples/img2xlsx.cpp index 493f7722..416d4b0e 100644 --- a/samples/img2xlsx.cpp +++ b/samples/img2xlsx.cpp @@ -1,3 +1,26 @@ +// Copyright (c) 2017 Thomas Fussell +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE +// +// @license: http://www.opensource.org/licenses/mit-license.php +// @author: see AUTHORS file + #include #include #include @@ -8,6 +31,8 @@ #define STB_IMAGE_IMPLEMENTATION #include "stb_image.h" +namespace { + // This sample demonstrates the use of some complex formatting methods to create // a workbook in which each cell has a fill based on the pixels of an image // thereby appearing as a mosaic of the given image. Two methods for achieving @@ -190,6 +215,8 @@ xlnt::workbook build_workbook(const pixmap &image) } } +} // namespace + // Entry point int main(int argc, char *argv[]) { diff --git a/samples/sample.cpp b/samples/sample.cpp index aee01a86..0e559ef7 100644 --- a/samples/sample.cpp +++ b/samples/sample.cpp @@ -1,14 +1,40 @@ +// Copyright (c) 2017 Thomas Fussell +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE +// +// @license: http://www.opensource.org/licenses/mit-license.php +// @author: see AUTHORS file + #include int main() { xlnt::workbook wb; xlnt::worksheet ws = wb.active_sheet(); + ws.cell("A1").value(5); ws.cell("B2").value("string data"); ws.cell("C3").formula("=RAND()"); + ws.merge_cells("C3:C4"); ws.freeze_panes("B2"); + wb.save("sample.xlsx"); return 0; diff --git a/tests/helpers/path_helper.hpp b/tests/helpers/path_helper.hpp index f023a6d3..1ec6e5cc 100644 --- a/tests/helpers/path_helper.hpp +++ b/tests/helpers/path_helper.hpp @@ -5,21 +5,8 @@ #include #include -#include #include -#ifdef __APPLE__ -#include -#include -#elif defined(_MSC_VER) -#include -#elif defined(__linux) -#include -#include -#include -#include -#endif - #define STRING_LITERAL2(a) #a #define LSTRING_LITERAL2(a) L#a #define U8STRING_LITERAL2(a) u8#a @@ -27,13 +14,48 @@ #define LSTRING_LITERAL(a) STRING_LITERAL2(a) #define U8STRING_LITERAL(a) STRING_LITERAL2(a) +#ifndef XLNT_BENCHMARK_DATA_DIR +#define XLNT_BENCHMARK_DATA_DIR "" +#endif + +#ifndef XLNT_SAMPLE_DATA_DIR +#define XLNT_SAMPLE_DATA_DIR "" +#endif + class path_helper { public: - static xlnt::path data_directory(const std::string &append = "") + static xlnt::path test_data_directory(const std::string &append = "") { static const std::string data_dir = STRING_LITERAL(XLNT_TEST_DATA_DIR); - return xlnt::path(data_dir).append(xlnt::path(append)); + return xlnt::path(data_dir); + } + + static xlnt::path test_file(const std::string &filename) + { + return test_data_directory().append(xlnt::path(filename)); + } + + static xlnt::path benchmark_data_directory(const std::string &append = "") + { + static const std::string data_dir = STRING_LITERAL(XLNT_BENCHMARK_DATA_DIR); + return xlnt::path(data_dir); + } + + static xlnt::path benchmark_file(const std::string &filename) + { + return benchmark_data_directory().append(xlnt::path(filename)); + } + + static xlnt::path sample_data_directory(const std::string &append = "") + { + static const std::string data_dir = STRING_LITERAL(XLNT_SAMPLE_DATA_DIR); + return xlnt::path(data_dir); + } + + static xlnt::path sample_file(const std::string &filename) + { + return sample_data_directory().append(xlnt::path(filename)); } static void copy_file(const xlnt::path &source, const xlnt::path &destination, bool overwrite) diff --git a/tests/helpers/timing.hpp b/tests/helpers/timing.hpp new file mode 100644 index 00000000..034cea69 --- /dev/null +++ b/tests/helpers/timing.hpp @@ -0,0 +1,39 @@ +// Copyright (c) 2017 Thomas Fussell +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE +// +// @license: http://www.opensource.org/licenses/mit-license.php +// @author: see AUTHORS file + +#include + +namespace xlnt { +namespace benchmarks { + +std::size_t current_time() +{ + auto now = std::chrono::system_clock::now(); + auto time_since_epoch = now.time_since_epoch(); + auto duration = std::chrono::duration(time_since_epoch); + + return static_cast(duration.count()); +} + +} // namespace benchmarks +} // namespace xlnt diff --git a/tests/workbook/serialization_test_suite.hpp b/tests/workbook/serialization_test_suite.hpp index 9cea90f5..e47ce21c 100644 --- a/tests/workbook/serialization_test_suite.hpp +++ b/tests/workbook/serialization_test_suite.hpp @@ -78,7 +78,7 @@ public: void test_produce_empty() { xlnt::workbook wb; - const auto path = path_helper::data_directory("3_default.xlsx"); + const auto path = path_helper::test_file("3_default.xlsx"); assert(workbook_matches_file(wb, path)); } @@ -202,14 +202,14 @@ public: sheet2.cell("C2").value(2); sheet2.cell("C3").value(3); - const auto path = path_helper::data_directory("10_comments_hyperlinks_formulae.xlsx"); + const auto path = path_helper::test_file("10_comments_hyperlinks_formulae.xlsx"); assert(workbook_matches_file(wb, path)); } void test_save_after_clear_all_formulae() { xlnt::workbook wb; - const auto path = path_helper::data_directory("10_comments_hyperlinks_formulae.xlsx"); + const auto path = path_helper::test_file("10_comments_hyperlinks_formulae.xlsx"); wb.load(path); auto ws1 = wb.sheet_by_index(0); @@ -228,35 +228,35 @@ public: void test_load_non_xlsx() { xlnt::workbook wb; - const auto path = path_helper::data_directory("1_powerpoint_presentation.xlsx"); + const auto path = path_helper::test_file("1_powerpoint_presentation.xlsx"); assert_throws(wb.load(path), xlnt::invalid_file); } void test_decrypt_agile() { xlnt::workbook wb; - const auto path = path_helper::data_directory("5_encrypted_agile.xlsx"); + const auto path = path_helper::test_file("5_encrypted_agile.xlsx"); assert_throws_nothing(wb.load(path, "secret")); } void test_decrypt_libre_office() { xlnt::workbook wb; - const auto path = path_helper::data_directory("6_encrypted_libre.xlsx"); + const auto path = path_helper::test_file("6_encrypted_libre.xlsx"); assert_throws_nothing(wb.load(path, u8"пароль")); } void test_decrypt_standard() { xlnt::workbook wb; - const auto path = path_helper::data_directory("7_encrypted_standard.xlsx"); + const auto path = path_helper::test_file("7_encrypted_standard.xlsx"); assert_throws_nothing(wb.load(path, "password")); } void test_decrypt_numbers() { xlnt::workbook wb; - const auto path = path_helper::data_directory("8_encrypted_numbers.xlsx"); + const auto path = path_helper::test_file("8_encrypted_numbers.xlsx"); assert_throws_nothing(wb.load(path, "secret")); } @@ -280,7 +280,7 @@ public: void test_comments() { xlnt::workbook wb; - const auto path = path_helper::data_directory("10_comments_hyperlinks_formulae.xlsx"); + const auto path = path_helper::test_file("10_comments_hyperlinks_formulae.xlsx"); wb.load(path); auto sheet1 = wb[0]; @@ -297,7 +297,7 @@ public: void test_read_hyperlink() { xlnt::workbook wb; - const auto path = path_helper::data_directory("10_comments_hyperlinks_formulae.xlsx"); + const auto path = path_helper::test_file("10_comments_hyperlinks_formulae.xlsx"); wb.load(path); auto ws1 = wb.sheet_by_index(0); @@ -320,7 +320,7 @@ public: void test_read_formulae() { xlnt::workbook wb; - const auto path = path_helper::data_directory("10_comments_hyperlinks_formulae.xlsx"); + const auto path = path_helper::test_file("10_comments_hyperlinks_formulae.xlsx"); wb.load(path); auto ws1 = wb.sheet_by_index(0); @@ -341,7 +341,7 @@ public: void test_read_headers_and_footers() { xlnt::workbook wb; - wb.load(path_helper::data_directory("11_print_settings.xlsx")); + wb.load(path_helper::test_file("11_print_settings.xlsx")); auto ws = wb.active_sheet(); assert_equals(ws.cell("A1").value(), "header"); @@ -373,7 +373,7 @@ public: void test_read_custom_properties() { xlnt::workbook wb; - wb.load(path_helper::data_directory("12_advanced_properties.xlsx")); + wb.load(path_helper::test_file("12_advanced_properties.xlsx")); assert(wb.has_custom_property("Client")); assert_equals(wb.custom_property("Client").get(), "me!"); } @@ -435,7 +435,7 @@ public: for (const auto file : files) { - auto path = path_helper::data_directory(file + ".xlsx"); + auto path = path_helper::test_file(file + ".xlsx"); assert(round_trip_matches_rw(path)); } } @@ -452,7 +452,7 @@ public: for (const auto file : files) { - auto path = path_helper::data_directory(file + ".xlsx"); + auto path = path_helper::test_file(file + ".xlsx"); auto password = std::string(file == "7_encrypted_standard" ? "password" : file == "6_encrypted_libre" ? u8"пароль" : "secret");