Start: Refactor f3d to use worker threads
This commit is contained in:
committed by
Benjamin Nauck
parent
da35868b96
commit
42cd4d76f2
@@ -28,3 +28,6 @@ endif(BUILD_SKETCHER)
|
||||
if(BUILD_SPREADSHEET)
|
||||
add_subdirectory(Spreadsheet)
|
||||
endif()
|
||||
if(BUILD_START)
|
||||
add_subdirectory(Start)
|
||||
endif()
|
||||
|
||||
12
tests/src/Mod/Start/App/CMakeLists.txt
Normal file
12
tests/src/Mod/Start/App/CMakeLists.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
target_sources(
|
||||
Start_tests_run
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/FileUtilities.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ThumbnailSource.cpp
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
Start_tests_run
|
||||
PUBLIC
|
||||
${CMAKE_BINARY_DIR}
|
||||
)
|
||||
94
tests/src/Mod/Start/App/FileUtilities.cpp
Normal file
94
tests/src/Mod/Start/App/FileUtilities.cpp
Normal file
@@ -0,0 +1,94 @@
|
||||
// SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "src/App/InitApplication.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <Mod/Start/App/FileUtilities.h>
|
||||
|
||||
|
||||
class FileUtilitiesTest: public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
static void SetUpTestSuite()
|
||||
{
|
||||
tests::initApplication();
|
||||
}
|
||||
|
||||
void SetUp() override
|
||||
{}
|
||||
|
||||
void TearDown() override
|
||||
{}
|
||||
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
TEST_F(FileUtilitiesTest, humanReadableSizeZeroBytes)
|
||||
{
|
||||
auto result = Start::humanReadableSize(0);
|
||||
EXPECT_EQ(result, "0 B");
|
||||
}
|
||||
|
||||
TEST_F(FileUtilitiesTest, humanReadableSizeBytesHasNoDecimal)
|
||||
{
|
||||
constexpr uint64_t smallNumberOfBytes {512};
|
||||
auto result = Start::humanReadableSize(smallNumberOfBytes);
|
||||
EXPECT_EQ(result.find('.'), std::string::npos);
|
||||
}
|
||||
|
||||
TEST_F(FileUtilitiesTest, humanReadableSizeOthersHaveDecimal)
|
||||
{
|
||||
constexpr std::array<uint64_t, 6> testSizes {1000,
|
||||
123456,
|
||||
123456789,
|
||||
123456789013,
|
||||
100000000000000,
|
||||
std::numeric_limits<uint64_t>::max()};
|
||||
for (const auto size : testSizes) {
|
||||
auto result = Start::humanReadableSize(size);
|
||||
EXPECT_NE(result.find('.'), std::string::npos);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(FileUtilitiesTest, humanReadableSizeB)
|
||||
{
|
||||
EXPECT_EQ("999 B", Start::humanReadableSize(999));
|
||||
}
|
||||
|
||||
TEST_F(FileUtilitiesTest, humanReadableSizekB)
|
||||
{
|
||||
EXPECT_EQ("1.0 kB", Start::humanReadableSize(1000));
|
||||
}
|
||||
|
||||
TEST_F(FileUtilitiesTest, humanReadableSizekBSignificantDigits)
|
||||
{
|
||||
EXPECT_EQ(Start::humanReadableSize(1000), Start::humanReadableSize(1001));
|
||||
}
|
||||
|
||||
TEST_F(FileUtilitiesTest, humanReadableSizeMB)
|
||||
{
|
||||
EXPECT_EQ("2.5 MB", Start::humanReadableSize(2.5e6));
|
||||
}
|
||||
|
||||
TEST_F(FileUtilitiesTest, humanReadableSizeGB)
|
||||
{
|
||||
EXPECT_EQ("3.7 GB", Start::humanReadableSize(3.7e9));
|
||||
}
|
||||
|
||||
TEST_F(FileUtilitiesTest, humanReadableSizeTB)
|
||||
{
|
||||
EXPECT_EQ("444.8 TB", Start::humanReadableSize(444.823e12));
|
||||
}
|
||||
|
||||
TEST_F(FileUtilitiesTest, humanReadableSizePB)
|
||||
{
|
||||
EXPECT_EQ("1.2 PB", Start::humanReadableSize(1.2e15));
|
||||
}
|
||||
|
||||
TEST_F(FileUtilitiesTest, humanReadableSizeEB)
|
||||
{
|
||||
EXPECT_EQ("7.3 EB", Start::humanReadableSize(7.3e18));
|
||||
}
|
||||
26
tests/src/Mod/Start/App/ThumbnailSource.cpp
Normal file
26
tests/src/Mod/Start/App/ThumbnailSource.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
// SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "src/App/InitApplication.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <Mod/Start/App/ThumbnailSource.h>
|
||||
|
||||
class ThumbnailSourceTest: public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
static void SetUpTestSuite()
|
||||
{
|
||||
tests::initApplication();
|
||||
}
|
||||
|
||||
void SetUp() override
|
||||
{}
|
||||
|
||||
void TearDown() override
|
||||
{}
|
||||
|
||||
|
||||
private:
|
||||
};
|
||||
12
tests/src/Mod/Start/CMakeLists.txt
Normal file
12
tests/src/Mod/Start/CMakeLists.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
target_include_directories(Start_tests_run PUBLIC
|
||||
${Python3_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
target_link_libraries(Start_tests_run
|
||||
gtest_main
|
||||
${Google_Tests_LIBS}
|
||||
Start
|
||||
)
|
||||
|
||||
add_subdirectory(App)
|
||||
Reference in New Issue
Block a user