#include <string>
#include <vector>
#include "Common/CommonTypes.h"
#include "Common/File/Path.h"
struct GPUDebugBuffer;
extern bool teamCityMode;
extern std::string currentTestName;
void TeamCityPrint(const char *fmt, ...);
void GitHubActionsPrint(const char *type, const char *fmt, ...);
Path ExpectedFromFilename(const Path &bootFilename);
Path ExpectedScreenshotFromFilename(const Path &bootFilename);
std::string GetTestName(const Path &bootFilename);
bool CompareOutput(const Path &bootFilename, const std::string &output, bool verbose);
std::vector<u32> TranslateDebugBufferToCompare(const GPUDebugBuffer *buffer, u32 stride, u32 h);
class ScreenshotComparer {
public:
ScreenshotComparer(const std::vector<u32> &pixels, u32 stride, u32 w, u32 h)
: pixels_(pixels), stride_(stride), w_(w), h_(h) {
}
~ScreenshotComparer();
double Compare(const Path &screenshotFilename);
std::string GetError() {
return error_;
}
bool SaveActualBitmap(const Path &filename);
bool SaveVisualComparisonPNG(const Path &filename);
protected:
void PlotVisualComparison(u32 *dst, u32 offset, u32 actual, u32 reference);
const std::vector<u32> &pixels_;
u32 *reference_ = nullptr;
bool asBitmap_ = false;
std::string error_;
u32 referenceStride_ = 0;
u32 stride_;
u32 w_;
u32 h_;
};