void TheCompiler_JobSucceeded(object sender, TexCompiler.Job job) { // it may happen that pdflatex returns after a new document has been created->then don't load the pdf if (job.DocumentID == DocumentID) { if (!job.GeneratePrecompiledHeaders) { // set the currrent BB, if the BB could be determined. // if not, and we are in preview mode, we have a problem if (job.hasBB) { Rect newBB = job.BB; newBB.Inflate(Properties.Settings.Default.BB_Margin, Properties.Settings.Default.BB_Margin); CurrentBB = newBB; } BBvalid = job.hasBB; // (re-)load the pdf to display PdfPath = Helper.RemoveFileExtension(job.path) + ".pdf"; if (OnPdfReady != null) { OnPdfReady(this, new PdfReadyEventArgs() { ReloadPdf = true }); } ReloadPdf++; } } }
public void TestSetup() { job = new TexCompiler.Job() { path = @"C:\Users\thomas\AppData\Local\Temp\mydummyfile.tex" }; }
public void TestSetup() { tc = new TexCompiler(); tc.JobDone += (s, e) => { LastReceivedJob = e.job; LastReceivedEA = e; JobFailed_Reported = e.ExitCode != 0; }; LastReceivedJob = null; LastReceivedEA = null; JobFailed_Reported = false; }
/* private string SavePdf(bool SaveAs) * { * if (SaveAs == false && CurFileNeverSaved) * { * MainWindow.AddStatusLine("Please save document first", true); * return ""; * } * * string s = Helper.GetCurrentWorkingDir(); * string t = Helper.GetPreviewFilename(); * string PreviewPdfFilePath = System.IO.Path.GetFullPath(CurFile) + t + ".pdf"; * string PdfFilePath = Helper.RemoveFileExtension(System.IO.Path.GetFullPath(CurFile)) + ".pdf"; * // string PreviewPdfFilePath = s + "\\" + CurFile + t + ".pdf"; * // string PdfFilePath = s + "\\" + Helper.RemoveFileExtension(CurFile) + ".pdf"; * * if (SaveAs == true) * { * SaveFileDialog sfd = new SaveFileDialog(); * * sfd.Filter = "Pdf Files|*.pdf" + * "|All Files|*.*"; * sfd.OverwritePrompt = true; * sfd.ValidateNames = true; * * sfd.FileName = System.IO.Path.GetFileName(CurFile); * // change file extension to .pdf * sfd.FileName = Helper.RemoveFileExtension(sfd.FileName) + ".pdf"; * sfd.InitialDirectory = System.IO.Path.GetDirectoryName(CurFile); * if (sfd.ShowDialog() != true) * return ""; * PdfFilePath = sfd.FileName; * } * * try * { * File.Copy(PreviewPdfFilePath, PdfFilePath, true); * } * catch (Exception Ex) * { * AddStatusLine("Could not save PDF. " + Ex.Message, true); * return ""; * } * * AddStatusLine("Preview PDF file saved as " + PdfFilePath); * return PdfFilePath; * } */ // this is called upon latex error,... the error is extracted from the latex output in the TexCompiler class void addProblemMarker(object sender, TexOutputParser.TexError err, TexCompiler.Job job = null) //String error, int linenr, TexCompiler.Severity severity) { // if job = null, the error was generated by the parser => always display // otherwise display only if the job really was the current document if (job == null || job.DocumentID == DocumentID) { TexErrors.Add(err); } }
public void AddJobTest_BBreadout() { // Check that the bounding box is read out and is approximately correct LastReceivedJob = null; tc.AddJobExclusive(NonStandAloneCode, null, true, 111); tc.AddJobExclusive(NonStandAloneCode, null, true, 111); Assert.AreNotEqual(LastReceivedJob, null); Assert.AreEqual(LastReceivedJob.DocumentID, 111); Assert.That(LastReceivedJob.BB.Width, Is.EqualTo(3).Within(0.5)); Assert.That(LastReceivedJob.BB.Height, Is.EqualTo(3).Within(0.5)); }
public void AddJobTest_BBreadout() { // Check that the bounding box is read out and is approximately correct LastReceivedJob = null; tc.AddJobExclusive(NonStandAloneCode, null, true, 111); tc.AddJobExclusive(NonStandAloneCode, null, true, 111); Assert.AreNotEqual(LastReceivedJob, null); Assert.AreEqual(LastReceivedJob.DocumentID, 111); Assert.IsTrue(Math.Abs(LastReceivedJob.BB.Width - 3) < .5); Assert.IsTrue(Math.Abs(LastReceivedJob.BB.Height - 3) < .5); }
public void LocksUpOnPdfInUseTest() { // lock the pdf, and check that still the compiler returns, and not produces deadlock LastReceivedJob = null; // compile, now pdf should be in place tc.AddJobExclusive(NonStandAloneCode, "temp3.tex", true, 113); // lock the pdf and recompile using (FileStream fs = new FileStream("temp3.pdf", FileMode.OpenOrCreate)) { // tc.timeout = 6000; tc.AddJobExclusive(NonStandAloneCode, "temp3.tex", true, 113); } Assert.AreNotEqual(LastReceivedJob, null); Assert.AreEqual(LastReceivedJob.DocumentID, 113); Assert.IsTrue(LastReceivedEA.OutputParseResult.Errors.Count() > 0); Assert.IsTrue(JobFailed_Reported); }