mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-21 06:45:39 -06:00
41 lines
1.1 KiB
C++
41 lines
1.1 KiB
C++
#include <RichText/RichText.h>
|
|
|
|
// Note: .pdf depends on test platform, needs to be updated
|
|
// It is in ~/autotest.qtf, needs to be copied (after checking) to autotest/Qtf
|
|
|
|
using namespace Upp;
|
|
|
|
CONSOLE_APP_MAIN
|
|
{
|
|
TimeStop tm;
|
|
|
|
StdLogSetup(LOG_COUT|LOG_FILE);
|
|
|
|
String outdir = GetHomeDirFile("autotest");
|
|
DeleteFolderDeep(outdir);
|
|
RealizeDirectory(outdir);
|
|
|
|
for(FindFile ff(GetDataFile("*.qtf")); ff; ff.Next()) {
|
|
String qtf = LoadFile(ff.GetPath());
|
|
LOG(ff.GetName() << ' ' << qtf.GetCount());
|
|
|
|
ASSERT(qtf.GetLength() > 10000);
|
|
RichText txt = ParseQTF(qtf);
|
|
String qtf2 = AsQTF(txt);
|
|
ASSERT(qtf2 == qtf);
|
|
SaveFile(AppendFileName(outdir, ff.GetName()), qtf2);
|
|
|
|
String pdfname = ForceExt(ff.GetName(), ".pdf");
|
|
String pdf = Pdf(txt);
|
|
SaveFile(AppendFileName(outdir, pdfname), pdf);
|
|
|
|
String h = LoadDataFile(pdfname);
|
|
ASSERT(h.GetCount() == pdf.GetCount());
|
|
int q = h.ReverseFind("trailer");
|
|
ASSERT(pdf.Mid(0, q) == h.Mid(0, q));
|
|
}
|
|
|
|
DeleteFolderDeep(outdir);
|
|
|
|
LOG("========== OK in " << tm << " s");
|
|
}
|