Skip to content

Commit 145730a

Browse files
committed
Merge branch 'hotfix/missing-test-files' into main
2 parents 215e6ee + bbf8135 commit 145730a

3 files changed

Lines changed: 33 additions & 8 deletions

File tree

editor/src/DocumentWindows/TestWindow/Shutdown.cpp

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "exceptions/Exceptions.hpp"
2020

2121
#include <fstream>
22+
#include <tinyfiledialogs.h>
2223

2324
#ifdef __linux__
2425
#include <sys/utsname.h>
@@ -151,18 +152,35 @@ namespace nexo::editor {
151152
const auto now_tp = floor<std::chrono::seconds>(std::chrono::system_clock::now());
152153
std::chrono::zoned_time local_zoned{std::chrono::current_zone(), now_tp};
153154
std::string ts = std::format("{:%Y%m%d}", local_zoned);
154-
const std::string filename = std::format("EditorTestResults_{}.report", ts);
155-
156-
const auto testDir = std::filesystem::path(Path::resolvePathRelativeToExe("../tests/editor"));
157-
std::filesystem::create_directories(testDir);
158-
auto filePath = testDir / filename;
159-
return filePath;
155+
const std::string filename = std::format("EditorTestResults_{}", ts);
156+
157+
// Tiny file dialog to get path
158+
// patterns
159+
const char *patterns[] = {"*.report"};
160+
const char *chosenPathStr = tinyfd_saveFileDialog(
161+
"Save Test Report",
162+
filename.c_str(),
163+
1,
164+
patterns,
165+
"Text files (*.report)"
166+
);
167+
if (!chosenPathStr) {
168+
return std::filesystem::path(); // User cancelled
169+
}
170+
const std::filesystem::path chosenPath = chosenPathStr;
171+
std::filesystem::create_directories(chosenPath.parent_path());
172+
return chosenPath;
160173
}
161174

162175
void TestWindow::writeTestReport()
163176
{
164177
const auto filePath = getTestReportFilePath();
165178

179+
if (filePath.empty()) {
180+
LOG(NEXO_WARN, "Test report generation cancelled by user");
181+
return;
182+
}
183+
166184
std::ofstream out(filePath.string());
167185
if (!out) {
168186
THROW_EXCEPTION(FileWriteException, filePath.string(), nexo::strerror(errno));

scripts/install.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,10 @@ install(DIRECTORY "${CMAKE_BINARY_DIR}/publish/" # source directory
105105
PATTERN "*.runtimeconfig.json" # select runtimeconfig.json files
106106
PATTERN "*.deps.json" # select deps.json files
107107
)
108+
109+
# Install test files
110+
install(DIRECTORY "${CMAKE_SOURCE_DIR}/tests/editor/"
111+
DESTINATION tests/editor
112+
FILES_MATCHING # install only matched files
113+
PATTERN "*.test" # select header files
114+
)

scripts/pack.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ project(nexo-pack)
1919
include("${CMAKE_CURRENT_SOURCE_DIR}/scripts/install.cmake")
2020

2121
# Set the version number
22-
set(NEXO_VERSION_MAJOR 1)
23-
set(NEXO_VERSION_MINOR 0)
22+
set(NEXO_VERSION_MAJOR 0)
23+
set(NEXO_VERSION_MINOR 2)
2424
set(NEXO_VERSION_PATCH 0)
2525

2626
# Set the project name

0 commit comments

Comments
 (0)