From 6232d13f5321b87ddf12a1aa36b4545da45f173d Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Wed, 17 Nov 2021 22:34:57 +0100 Subject: Travel3: Simple image and video display site Reads the images and videos from filesystem and builds a site in memroy. --- test/file_test.hh | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 test/file_test.hh (limited to 'test/file_test.hh') diff --git a/test/file_test.hh b/test/file_test.hh new file mode 100644 index 0000000..af66dfc --- /dev/null +++ b/test/file_test.hh @@ -0,0 +1,45 @@ +#ifndef FILE_TEST_HH +#define FILE_TEST_HH + +#include "unique_fd.hh" + +#include +#include +#include + +class FileTest : public testing::Test { +public: + static unique_fd create_temp_file(std::string const& extension, + std::filesystem::path* path); + +protected: + FileTest(); + ~FileTest() override; + + void SetUp() override; + + std::filesystem::path const& path() const { + return path_; + } + + void write(std::string_view content); + + int fd() const { + return fd_.get(); + } + + unique_fd release() { + return std::move(fd_); + } + + void close(); + +protected: + virtual std::string const& extension(); + +private: + std::filesystem::path path_; + unique_fd fd_; +}; + +#endif // FILE_TEST_HH -- cgit v1.2.3-70-g09d2