tests: Fixed unit test compiling
This commit is contained in:
parent
8631cb0c2a
commit
26a0352851
25
include/views/view_diff.hpp
Normal file
25
include/views/view_diff.hpp
Normal file
@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#include <hex.hpp>
|
||||
|
||||
#include <imgui.h>
|
||||
#include <hex/views/view.hpp>
|
||||
|
||||
#include <array>
|
||||
#include <string>
|
||||
|
||||
namespace hex {
|
||||
|
||||
namespace prv { class Provider; }
|
||||
|
||||
class ViewTools : public View {
|
||||
public:
|
||||
ViewTools();
|
||||
~ViewTools() override;
|
||||
|
||||
void drawContent() override;
|
||||
void drawMenu() override;
|
||||
|
||||
};
|
||||
|
||||
}
|
@ -30,7 +30,7 @@ namespace hex {
|
||||
|
||||
~File();
|
||||
|
||||
bool isValid() { return this->m_file != nullptr; }
|
||||
bool isValid() const { return this->m_file != nullptr; }
|
||||
|
||||
void seek(u64 offset);
|
||||
|
||||
@ -42,7 +42,7 @@ namespace hex {
|
||||
void write(const std::vector<u8> &bytes);
|
||||
void write(const std::string &string);
|
||||
|
||||
size_t getSize();
|
||||
size_t getSize() const;
|
||||
void setSize(u64 size);
|
||||
|
||||
auto getHandle() { return this->m_file; }
|
||||
|
@ -72,7 +72,7 @@ namespace hex {
|
||||
fwrite(string.data(), string.size(), 1, this->m_file);
|
||||
}
|
||||
|
||||
size_t File::getSize() {
|
||||
size_t File::getSize() const {
|
||||
if (!isValid()) return 0;
|
||||
|
||||
auto startPos = ftello64(this->m_file);
|
||||
|
26
source/views/view_diff.cpp
Normal file
26
source/views/view_diff.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include "views/view_tools.hpp"
|
||||
|
||||
#include <hex/providers/provider.hpp>
|
||||
|
||||
namespace hex {
|
||||
|
||||
ViewTools::ViewTools() : View("hex.view.tools.name") { }
|
||||
|
||||
ViewTools::~ViewTools() { }
|
||||
|
||||
void ViewTools::drawContent() {
|
||||
if (ImGui::Begin(View::toWindowName("hex.view.tools.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) {
|
||||
for (const auto& [name, function] : ContentRegistry::Tools::getEntries()) {
|
||||
if (ImGui::CollapsingHeader(LangEntry(name))) {
|
||||
function();
|
||||
}
|
||||
}
|
||||
}
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void ViewTools::drawMenu() {
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -17,13 +17,17 @@ namespace hex::test {
|
||||
}
|
||||
~TestProvider() override = default;
|
||||
|
||||
bool isAvailable() override { return true; }
|
||||
bool isReadable() override { return true; }
|
||||
bool isWritable() override { return false; }
|
||||
bool isResizable() override { return false; }
|
||||
bool isSavable() override { return false; }
|
||||
[[nodiscard]] bool isAvailable() const override { return true; }
|
||||
[[nodiscard]] bool isReadable() const override { return true; }
|
||||
[[nodiscard]] bool isWritable() const override { return false; }
|
||||
[[nodiscard]] bool isResizable() const override { return false; }
|
||||
[[nodiscard]] bool isSavable() const override { return false; }
|
||||
|
||||
std::vector<std::pair<std::string, std::string>> getDataInformation() override {
|
||||
[[nodiscard]] std::string getName() const override {
|
||||
return "";
|
||||
}
|
||||
|
||||
[[nodiscard]] std::vector<std::pair<std::string, std::string>> getDataInformation() const override {
|
||||
return { };
|
||||
}
|
||||
|
||||
@ -37,8 +41,8 @@ namespace hex::test {
|
||||
this->m_testFile.write(static_cast<const u8*>(buffer), size);
|
||||
}
|
||||
|
||||
size_t getActualSize() override {
|
||||
return m_testFile.getSize();
|
||||
size_t getActualSize() const override {
|
||||
return this->m_testFile.getSize();
|
||||
}
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user