ultimatepp/autotest/Qtf/Qtf.cpp
cxl 3a32d739a4 .autotest
git-svn-id: svn://ultimatepp.org/upp/trunk@10383 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2016-10-29 11:09:27 +00:00

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");
}