Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance fixed when working with large files #47

Merged
merged 11 commits into from
Jan 22, 2024
6 changes: 3 additions & 3 deletions .github/workflows/artifcats.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ jobs:
- name: Install Qt6
uses: jurplel/install-qt-action@v3
with:
version: '6.5.2'
version: '6.6.1'
host: windows
target: desktop
arch: win64_msvc2019_64
dir: ${{github.workspace}}
tools: tools_openssl_x64
tools: tools_opensslv3_x64

- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -101,7 +101,7 @@ jobs:
makeappx.exe pack /d ${{github.workspace}}\_msix\ /p ${{github.workspace}}\_artifacts\PBOManager.${{env.pbom_msix_version}}.msix

- name: Upload MSIX package
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: PBOManager-msix-${{env.pbom_version}}-${{env.pbom_build_number}}
path: ${{github.workspace}}\_artifacts\PBOManager.${{env.pbom_msix_version}}.msix
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Install Qt6
uses: jurplel/install-qt-action@v3
with:
version: '6.5.2'
version: '6.6.1'
host: windows
target: desktop
arch: win64_msvc2019_64
Expand Down
8 changes: 4 additions & 4 deletions installer/PBOManager.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,14 @@
Source="$(var.ArtifactsFolder)Qt6Network.dll" />
</Component>

<Component Id="C_MainFiles__LibCrypto.dll" Guid="D20CBC68-368C-4B9C-A86B-0DC53656BAD4" Win64="yes">
<Component Id="C_MainFiles__LibCrypto.dll" Guid="1B84214B-875F-4973-9F9F-C418483F7411" Win64="yes">
<File Id="F_MainFiles__LibCrypto.dll" KeyPath="yes" Vital="yes"
Source="$(var.ArtifactsFolder)libcrypto-1_1-x64.dll" />
Source="$(var.ArtifactsFolder)libcrypto-3-x64.dll" />
</Component>

<Component Id="C_MainFiles__LibSsl.dll" Guid="3F707811-31E4-4EAE-BB35-2F7013107C7C" Win64="yes">
<Component Id="C_MainFiles__LibSsl.dll" Guid="EE38BD8E-35A9-4813-A157-519B1C5A25FA" Win64="yes">
<File Id="F_MainFiles__LibSsl.dll" KeyPath="yes" Vital="yes"
Source="$(var.ArtifactsFolder)libssl-1_1-x64.dll" />
Source="$(var.ArtifactsFolder)libssl-3-x64.dll" />
</Component>
</DirectoryRef>

Expand Down
4 changes: 2 additions & 2 deletions pbom/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ install(FILES
${QT_BINARIES_DIR}/plugins/tls/qschannelbackend${QT_BINARIES_SUFFIX}.dll
DESTINATION ${CMAKE_INSTALL_BINDIR}/tls)
install(FILES
${QT_BINARIES_DIR}/../../Tools/OpenSSL/Win_x64/bin/libssl-1_1-x64.dll
${QT_BINARIES_DIR}/../../Tools/OpenSSL/Win_x64/bin/libcrypto-1_1-x64.dll
${QT_BINARIES_DIR}/../../Tools/OpenSSLv3/Win_x64/bin/libssl-3-x64.dll
${QT_BINARIES_DIR}/../../Tools/OpenSSLv3/Win_x64/bin/libcrypto-3-x64.dll
DESTINATION ${CMAKE_INSTALL_BINDIR})

add_executable(pbom_test ${PROJECT_SOURCES} ${PROJECT_SOURCES_UI} ${TEST_SOURCES} exception.cpp testmain.cpp)
Expand Down
78 changes: 17 additions & 61 deletions pbom/domain/__test__/func_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,76 +4,32 @@

namespace pboman3::domain::test {
TEST(FuncTest, CountFilesInTree_Counts_Files) {
PboNode node("file.pbo", PboNodeType::Container, nullptr);
node.createHierarchy(PboPath("f1/e1.txt"));
node.createHierarchy(PboPath("f1/e2.txt"));
node.createHierarchy(PboPath("f1/f2/e2.txt"));
node.createHierarchy(PboPath("e2.txt"));
const auto node = QSharedPointer<PboNode>::create("file.pbo", PboNodeType::Container, nullptr);
node->createHierarchy(PboPath("f1/e1.txt"));
node->createHierarchy(PboPath("f1/e2.txt"));
node->createHierarchy(PboPath("f1/f2/e2.txt"));
node->createHierarchy(PboPath("e2.txt"));

int count = 0;
CountFilesInTree(node, count);
CountFilesInTree(*node, count);

ASSERT_EQ(count, 4);
}

TEST(FuncTest, FindDirectChild_Finds_Child_Case_Insensitively_Const) {
PboNode node("file.pbo", PboNodeType::Container, nullptr);
node.createHierarchy(PboPath("e1.txt"));
node.createHierarchy(PboPath("e2.txt"));
PboNode* e3 = node.createHierarchy(PboPath("e3.txt"));

const PboNode* found = FindDirectChild(const_cast<const PboNode*>(&node), "E3.TxT");

ASSERT_EQ(e3, found);
}

TEST(FuncTest, FindDirectChild_Returns_Null_Const) {
PboNode node("file.pbo", PboNodeType::Container, nullptr);
node.createHierarchy(PboPath("e1.txt"));
node.createHierarchy(PboPath("e2.txt"));
node.createHierarchy(PboPath("e3.txt"));

const PboNode* found = FindDirectChild(const_cast<const PboNode*>(&node), "e4.txt");

ASSERT_EQ(found, nullptr);
}

TEST(FuncTest, FindDirectChild_Finds_Child_Case_Insensitively_NonConst) {
PboNode node("file.pbo", PboNodeType::Container, nullptr);
node.createHierarchy(PboPath("e1.txt"));
node.createHierarchy(PboPath("e2.txt"));
PboNode* e3 = node.createHierarchy(PboPath("e3.txt"));

const PboNode* found = FindDirectChild(&node, "E3.TxT");

ASSERT_EQ(e3, found);
}

TEST(FuncTest, FindDirectChild_Returns_Null_NonConst) {
PboNode node("file.pbo", PboNodeType::Container, nullptr);
node.createHierarchy(PboPath("e1.txt"));
node.createHierarchy(PboPath("e2.txt"));
node.createHierarchy(PboPath("e3.txt"));

const PboNode* found = FindDirectChild(&node, "e4.txt");

ASSERT_EQ(found, nullptr);
}

TEST(FuncTest, IsPathConflict_Functional) {
PboNode root("file-name", PboNodeType::Container, nullptr);
ASSERT_EQ(root.depth(), 0);
const auto root = QSharedPointer<PboNode>::create("file-name", PboNodeType::Container, nullptr);
ASSERT_EQ(root->depth(), 0);

root.createHierarchy(PboPath("e1.txt"));
root.createHierarchy(PboPath("f2/e2.txt"));
root->createHierarchy(PboPath("e1.txt"));
root->createHierarchy(PboPath("f2/e2.txt"));

ASSERT_TRUE(IsPathConflict(&root, PboPath("e1.txT")));
ASSERT_TRUE(IsPathConflict(&root, PboPath("f2")));
ASSERT_TRUE(IsPathConflict(&root, PboPath("F2/e2.Txt")));
ASSERT_TRUE(IsPathConflict(&root, PboPath("f2/E2.txt/e4.txt")));
ASSERT_TRUE(IsPathConflict(root.get(), PboPath("e1.txT")));
ASSERT_TRUE(IsPathConflict(root.get(), PboPath("f2")));
ASSERT_TRUE(IsPathConflict(root.get(), PboPath("F2/e2.Txt")));
ASSERT_TRUE(IsPathConflict(root.get(), PboPath("f2/E2.txt/e4.txt")));

ASSERT_FALSE(IsPathConflict(&root, PboPath("e2.txt")));
ASSERT_FALSE(IsPathConflict(&root, PboPath("f2/e3.txt")));
ASSERT_FALSE(IsPathConflict(&root, PboPath("f3/e4.txt")));
ASSERT_FALSE(IsPathConflict(root.get(), PboPath("e2.txt")));
ASSERT_FALSE(IsPathConflict(root.get(), PboPath("f2/e3.txt")));
ASSERT_FALSE(IsPathConflict(root.get(), PboPath("f3/e4.txt")));
}
}
Loading