C2026-041-invisible-position-changes-as-differences #807

Merged
jjenko merged 14 commits from C2026-041-invisible-position-changes-as-differences into Development 2026-09-03 08:56:33 -04:00
4 changed files with 75 additions and 94 deletions
Showing only changes of commit 1cb397f47b - Show all commits

No files matched your search

+2 -1
View File
@@ -89,7 +89,7 @@
this.panel1.Size = new System.Drawing.Size(707, 80); this.panel1.Size = new System.Drawing.Size(707, 80);
this.panel1.TabIndex = 0; this.panel1.TabIndex = 0;
// //
// cbUseTruncatedData // cbUseTruncatedData // C2026-041
// //
this.cbUseTruncatedData.AutoSize = true; this.cbUseTruncatedData.AutoSize = true;
this.cbUseTruncatedData.Location = new System.Drawing.Point(456, 56); this.cbUseTruncatedData.Location = new System.Drawing.Point(456, 56);
@@ -99,6 +99,7 @@
this.cbUseTruncatedData.Text = "Use Truncated Data"; this.cbUseTruncatedData.Text = "Use Truncated Data";
this.tt.SetToolTip(this.cbUseTruncatedData, "Set the Search to be Case Sensitive\r\nUppercase and Lowercase will not match"); this.tt.SetToolTip(this.cbUseTruncatedData, "Set the Search to be Case Sensitive\r\nUppercase and Lowercase will not match");
this.cbUseTruncatedData.UseVisualStyleBackColor = true; this.cbUseTruncatedData.UseVisualStyleBackColor = true;
this.cbUseTruncatedData.Click += new System.EventHandler(this.cbUseTruncatedData_Click);
// //
// btnUC // btnUC
// //
+67 -56
View File
@@ -43,15 +43,16 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data; using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO; using System.IO;
using System.Text.RegularExpressions; using System.Linq;
using System.Xml.Serialization;
using System.Xml.Schema;
using System.Xml;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;
mschill marked this conversation as resolved
Review

Is this using used?

Is this using used?
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;
namespace Baseline namespace Baseline
{ {
@@ -73,6 +74,7 @@ namespace Baseline
public IgnoreLines MyIgnore { get; set; } = new IgnoreLines(); public IgnoreLines MyIgnore { get; set; } = new IgnoreLines();
private LastWas myLast = LastWas.Search; private LastWas myLast = LastWas.Search;
private Settings MySettings; private Settings MySettings;
public bool TruncatedDataFg { get; set; } = false;
public string MyStatus public string MyStatus
{ {
get { return tsslStatus.Text; } get { return tsslStatus.Text; }
@@ -202,6 +204,13 @@ namespace Baseline
MyIgnore = IgnoreLines.Get(saveOriginal); MyIgnore = IgnoreLines.Get(saveOriginal);
} }
} }
private void cbUseTruncatedData_Click(object sender, EventArgs e)
{
System.Windows.Forms.CheckBox item = (System.Windows.Forms.CheckBox)sender;
TruncatedDataFg = item.Checked;
}
//}
/// <summary> /// <summary>
/// Process DebugPagination.txt in all sub-folders /// Process DebugPagination.txt in all sub-folders
/// </summary> /// </summary>
@@ -218,7 +227,7 @@ namespace Baseline
lbResults2.Items.Clear(); lbResults2.Items.Clear();
MyStatus = "Searching..."; MyStatus = "Searching...";
// Perform DebugPagination Comparison // Perform DebugPagination Comparison
FindFiles fnd = new FindFiles(cbFile1.Text, cbFile2.Text, "DebugPagination.txt",MyIgnore); FindFiles fnd = new FindFiles(cbFile1.Text, cbFile2.Text, "DebugPagination.txt",MyIgnore, cbUseTruncatedData.Checked);
lbDifferent.DataSource = fnd; lbDifferent.DataSource = fnd;
lbDifferent.DisplayMember = "File1"; lbDifferent.DisplayMember = "File1";
MyStatus = string.Format("{0} Differences Found", fnd.Count); MyStatus = string.Format("{0} Differences Found", fnd.Count);
@@ -708,25 +717,9 @@ namespace Baseline
lbResults1.Items.Clear(); lbResults1.Items.Clear();
lbResults2.Items.Clear(); lbResults2.Items.Clear();
MyStatus = "Searching..."; MyStatus = "Searching...";
FindFiles fnd;
// Perform code to find DebugMeta files with diffences FindFiles fnd = new FindFiles(cbFile1.Text, cbFile2.Text, "DebugMeta.txt", MyIgnore, cbUseTruncatedData.Checked);
if (cbUseTruncatedData.Checked)
{
string filename;
if (File.Exists(cbFile1.Text + "\\VEPROMS_BGE\\DebugMeta_Truncate.txt"))
{
filename = "DebugMeta_Truncate.txt";
}
else
{
filename = "DebugMeta.txt";
}
fnd = new FindFiles(cbFile1.Text, cbFile2.Text, filename, MyIgnore);
}
else
{
fnd = new FindFiles(cbFile1.Text, cbFile2.Text, "DebugMeta.txt", MyIgnore);
}
lbDifferent.DataSource = fnd; lbDifferent.DataSource = fnd;
lbDifferent.DisplayMember = "File1"; lbDifferent.DisplayMember = "File1";
MyStatus = string.Format("{0} Differences Found", fnd.Count); MyStatus = string.Format("{0} Differences Found", fnd.Count);
@@ -747,28 +740,10 @@ namespace Baseline
lbDifferent.Items.Clear(); lbDifferent.Items.Clear();
lbResults1.Items.Clear(); lbResults1.Items.Clear();
lbResults2.Items.Clear(); lbResults2.Items.Clear();
FindFiles fnd;
MyStatus = "Searching..."; MyStatus = "Searching...";
//Perform Search //Perform Search
if (cbUseTruncatedData.Checked) FindFiles fnd = new FindFiles(cbFile1.Text, cbFile2.Text, "DebugMeta.txt", tbSearch.Text, SearchType.Contains, cbCaseSensitive.Checked, cbUseTruncatedData.Checked);
{
string filename;
if (File.Exists(cbFile1.Text + "\\VEPROMS_BGE\\DebugMeta_Truncate.txt"))
{
filename = "DebugMeta_Truncate.txt";
}
else
{
filename = "DebugMeta.txt";
}
fnd = new FindFiles(cbFile1.Text, cbFile2.Text, filename, tbSearch.Text, SearchType.Contains, cbCaseSensitive.Checked);
}
else
{
fnd = new FindFiles(cbFile1.Text, cbFile2.Text, "DebugMeta.txt", tbSearch.Text, SearchType.Contains, cbCaseSensitive.Checked);
}
lbDifferent.DataSource = fnd; lbDifferent.DataSource = fnd;
lbDifferent.DisplayMember = "File1"; lbDifferent.DisplayMember = "File1";
MyStatus = string.Format("{0} Differences Found", fnd.Count); MyStatus = string.Format("{0} Differences Found", fnd.Count);
} }
@@ -874,7 +849,12 @@ namespace Baseline
public partial class FindFiles : List<FindFile> public partial class FindFiles : List<FindFile>
{ {
private readonly string _FileName; private readonly string _FileName;
private object _fileName;
mschill marked this conversation as resolved
Review

This should not have been added / I believe this is not used.

This should not have been added / I believe this is not used.
public string FileName => _FileName; public string FileName => _FileName;
//public bool TruncatedDataFg { get; set; } = false;
/// <summary> /// <summary>
/// Build list of DocVersion Folders with differences /// Build list of DocVersion Folders with differences
/// </summary> /// </summary>
@@ -882,12 +862,12 @@ namespace Baseline
/// <param name="path2">Compare path</param> /// <param name="path2">Compare path</param>
/// <param name="fileName">filename</param> /// <param name="fileName">filename</param>
/// <param name="myIgnore">Ignore list</param> /// <param name="myIgnore">Ignore list</param>
public FindFiles(string path1, string path2, string fileName,IgnoreLines myIgnore) public FindFiles(string path1, string path2, string fileName,IgnoreLines myIgnore, bool TruncatedDataFg)
{ {
DirectoryInfo di1 = new DirectoryInfo(path1); DirectoryInfo di1 = new DirectoryInfo(path1);
DirectoryInfo di2 = new DirectoryInfo(path2); DirectoryInfo di2 = new DirectoryInfo(path2);
_FileName = fileName; _FileName = fileName;
FillByCompare(di1, di2, fileName, myIgnore); FillByCompare(di1, di2, fileName, myIgnore, TruncatedDataFg, false);
} }
/// <summary> /// <summary>
/// Fill for a search /// Fill for a search
@@ -898,12 +878,12 @@ namespace Baseline
/// <param name="searchText"></param> /// <param name="searchText"></param>
/// <param name="searchType"></param> /// <param name="searchType"></param>
/// <param name="caseSensitive"></param> /// <param name="caseSensitive"></param>
public FindFiles(string path1, string path2, string fileName, string searchText, SearchType searchType, bool caseSensitive) public FindFiles(string path1, string path2, string fileName, string searchText, SearchType searchType, bool caseSensitive, bool useTruncatedData)
{ {
DirectoryInfo di1 = new DirectoryInfo(path1); DirectoryInfo di1 = new DirectoryInfo(path1);
DirectoryInfo di2 = new DirectoryInfo(path2); DirectoryInfo di2 = new DirectoryInfo(path2);
_FileName = fileName; _FileName = fileName;
FillByCompare(di1, di2, fileName,searchText,searchType, caseSensitive); FillByCompare(di1, di2, fileName,searchText,searchType, caseSensitive, useTruncatedData);
} }
/// <summary> /// <summary>
/// Fill results by search /// Fill results by search
@@ -914,13 +894,13 @@ namespace Baseline
/// <param name="searchText"></param> /// <param name="searchText"></param>
/// <param name="searchType"></param> /// <param name="searchType"></param>
/// <param name="caseSensitive"></param> /// <param name="caseSensitive"></param>
private void FillByCompare(DirectoryInfo di1, DirectoryInfo di2, string fileName, string searchText, SearchType searchType, bool caseSensitive) private void FillByCompare(DirectoryInfo di1, DirectoryInfo di2, string fileName, string searchText, SearchType searchType, bool caseSensitive, bool UseTruncatedData)
{ {
foreach (DirectoryInfo diChild1 in di1.GetDirectories()) foreach (DirectoryInfo diChild1 in di1.GetDirectories())
{ {
DirectoryInfo diChild2 = new DirectoryInfo(di2.FullName + "\\" + diChild1.Name); DirectoryInfo diChild2 = new DirectoryInfo(di2.FullName + "\\" + diChild1.Name);
if (diChild2.Exists) if (diChild2.Exists)
FillByCompare(diChild1, diChild2, fileName,searchText,searchType,caseSensitive); FillByCompare(diChild1, diChild2, fileName,searchText,searchType,caseSensitive, UseTruncatedData);
} }
foreach (FileInfo fiChild1 in di1.GetFiles(fileName)) foreach (FileInfo fiChild1 in di1.GetFiles(fileName))
{ {
@@ -994,17 +974,25 @@ namespace Baseline
} }
return false; return false;
} }
private void FillByCompare(DirectoryInfo di1, DirectoryInfo di2, string fileName, IgnoreLines myIgnore) private void FillByCompare(DirectoryInfo di1, DirectoryInfo di2, string fileName, IgnoreLines myIgnore, bool TruncatedDataFg = false, bool foundFileFg = false)
{ {
if (TruncatedDataFg) // C2026-041 is the "Use Truncated Data" checked
{
if (!foundFileFg) // flag to indicate if the correct DebugMeta file has been found.
{
fileName = getDebubMetaFile(di1, di2, ref foundFileFg); // C2026-041 Check if the DebugMeta_Truncate.txt file is found in the baseline bench mark and the new release being tested.
}
}
foreach (DirectoryInfo diChild1 in di1.GetDirectories()) foreach (DirectoryInfo diChild1 in di1.GetDirectories())
{ {
DirectoryInfo diChild2 = new DirectoryInfo(di2.FullName + "\\" + diChild1.Name); DirectoryInfo diChild2 = new DirectoryInfo(Path.Combine(di2.FullName + "\\" + diChild1.Name));
mschill marked this conversation as resolved
Review

Commented out code should be removed

Commented out code should be removed
if (diChild2.Exists) if (diChild2.Exists)
FillByCompare(diChild1, diChild2, fileName,myIgnore);// Recursively work on Sub-Folders FillByCompare(diChild1, diChild2, fileName,myIgnore, TruncatedDataFg, foundFileFg);// Recursively work on Sub-Folders
} }
foreach (FileInfo fiChild1 in di1.GetFiles(fileName)) foreach (FileInfo fiChild1 in di1.GetFiles(fileName))
{ {
FileInfo fiChild2 = new FileInfo(di2.FullName + "\\" + fiChild1.Name); FileInfo fiChild2 = new FileInfo(Path.Combine(di2.FullName, fiChild1.Name));
if (fiChild2.Exists) if (fiChild2.Exists)
{ {
if (CompareFile(fiChild1, fiChild2,myIgnore)) if (CompareFile(fiChild1, fiChild2,myIgnore))
@@ -1012,6 +1000,29 @@ namespace Baseline
} }
} }
} }
private string getDebubMetaFile(DirectoryInfo di1, DirectoryInfo di2, ref bool foundFileFg) // C2026-041
{
string flnm = "";
DirectoryInfo dr1 = di1.GetDirectories()[0]; // get first folder for test of which DebugMeta file to use. The DebugMeta files are found only ineach proc set folder.
if (!dr1.Name.Substring(0, 8).Contains("VEPROMS_") && !foundFileFg)
{
if (File.Exists(Path.Combine(dr1.FullName, "DebugMeta_Truncated.txt")) && File.Exists(Path.Combine(di2.FullName, dr1.Name, "DebugMeta_Truncated.txt"))) // if DebugMeta_Truncate.txt file is found.
{
flnm = "DebugMeta_Truncated.txt";
foundFileFg = true;
}
else
{
flnm = "DebugMeta.txt";
foundFileFg = true;
}
}
else
{
flnm = "DebugMeta.txt";
}
return flnm;
}
private bool CompareFile(FileInfo fiChild1, FileInfo fiChild2,IgnoreLines myIgnore) private bool CompareFile(FileInfo fiChild1, FileInfo fiChild2,IgnoreLines myIgnore)
{ {
if (fiChild1.Name == "DebugMeta.txt") if (fiChild1.Name == "DebugMeta.txt")
+4 -35
View File
@@ -2,7 +2,6 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text; using System.Text;
using System.Windows.Forms;
namespace Volian.Base.Library namespace Volian.Base.Library
{ {
@@ -161,52 +160,22 @@ namespace Volian.Base.Library
} }
public static void Write(string format, params object[] args) public static void Write(string format, params object[] args)
{ {
mschill marked this conversation as resolved
Review

Write should be removed - it is not called from anywhere.

Write should be removed - it is not called from anywhere.
if (args.GetUpperBound(0) != -1) // are there arguments?
{
if (args[args.GetUpperBound(0)] == "truncate_false") // if there is a 9th element test the value for truncated data.
{
_MyDebugPrint.Write(format, args); // only save to DebugMeta.txt if there is different truncate data.
}
else
{
_MyDebugPrint_Truncated.Write(format, args); // Save to both files if there is no special truncate data.
_MyDebugPrint.Write(format, args); _MyDebugPrint.Write(format, args);
} }
}
else
{
_MyDebugPrint_Truncated.Write(format, args);
_MyDebugPrint.Write(format, args);
}
}
public static void WriteLine(string format, params object[] args) public static void WriteLine(string format, params object[] args)
{
if (args.GetUpperBound(0) != -1) // are there arguments?
{
if (args[args.GetUpperBound(0)] == "truncate_false") // if there is a 9th element test the value for truncated data.
{
_MyDebugPrint.WriteLine(format, args); // only save to DebugMeta.txt if there is different truncate data.
}
else
{
_MyDebugPrint_Truncated.WriteLine(format, args); // Save to both files if there is no special truncate data.
_MyDebugPrint.WriteLine(format, args);
}
}
else
{ {
_MyDebugPrint_Truncated.WriteLine(format, args); _MyDebugPrint_Truncated.WriteLine(format, args);
_MyDebugPrint.WriteLine(format, args); _MyDebugPrint.WriteLine(format, args);
} }
} public static void WriteLineTruncate(string format, params object[] args)
public static void TruncateWriteLine(string format, params object[] args)
{ {
_MyDebugPrint_Truncated.WriteLine(format, args); _MyDebugPrint_Truncated.WriteLine(format, args);
} }
public static void TruncateWrite(string format, params object[] args) public static void WriteLineLegacy(string format, params object[] args)
{ {
_MyDebugPrint_Truncated.Write(format, args); // SaveFileDialog special truncate data _MyDebugPrint.WriteLine(format, args);
} }
public static void Show() public static void Show()
{ _MyDebugPrint.Show(); { _MyDebugPrint.Show();
+2 -2
View File
@@ -1419,9 +1419,9 @@ namespace Volian.Print.Library
if (_MyHelper.DidFirstPageDocStyle) yoff = origYoff - (float)mySection.MyDocStyle.Layout.TopMargin; if (_MyHelper.DidFirstPageDocStyle) yoff = origYoff - (float)mySection.MyDocStyle.Layout.TopMargin;
// C2018-004 create meta file for baseline compares // C2018-004 create meta file for baseline compares
mschill marked this conversation as resolved
Review
  1. Per John's email:

Suggest to add a program switch to generate (at the same time - in a separate file) a DebugMeta as it was along with the new DebugMeta.

That way one run of printing can generate both. The next time baselines are run, the Baseline.exe program can compare the older run - there really should not be any differences. If all good that we can move forward with using the new version of the DebugMeta file.

Otherwise comparing the new DebugMeta would generate even more false - differences.

Having a program switch to also generate the old style DebugMeta would keep Baseline testing backward compatible, should we find a need in the future.

1. Per John's email: Suggest to add a program switch to generate (at the same time - in a separate file) a DebugMeta as it was along with the new DebugMeta. That way one run of printing can generate both. The next time baselines are run, the Baseline.exe program can compare the older run - there really should not be any differences. If all good that we can move forward with using the new version of the DebugMeta file. Otherwise comparing the new DebugMeta would generate even more false - differences. Having a program switch to also generate the old style DebugMeta would keep Baseline testing backward compatible, should we find a need in the future.
Review

For the program switch are you referring to the new checkbox in the baseline program or a PROMS switch? I added the new checkbox to baseline.

For the program switch are you referring to the new checkbox in the baseline program or a PROMS switch? I added the new checkbox to baseline.
Review

this is an old item from a week or two ago.

outstanding items include:

1 performance item --- passing strings and if statements added to BaselineMetaFile.WriteLine
1 cleanup unnecessary usings
1 change to finding debug file ---- should check inside findfiles on an individual file basis whether to use truncated or not. also, should not concatinate strings --- should use path.combine or interpolated strings

this is an old item from a week or two ago. outstanding items include: 1 performance item --- passing strings and if statements added to BaselineMetaFile.WriteLine 1 cleanup unnecessary usings 1 change to finding debug file ---- should check inside findfiles on an individual file basis whether to use truncated or not. also, should not concatinate strings --- should use path.combine or interpolated strings
Volian.Base.Library.BaselineMetaFile.WriteLine("WD Height={0} Width={1} scPgCnt={2} locEnd={3} pdfSz={4} xOff={5} yOff={6} ScPgNum {7}", fgPage.Height, fgPage.Width, sectPageCount, locEndOfWordDoc, pdfSize, (float)(mySection.MyDocStyle.Layout.MSWordXAdj ?? 0.0), (float)(mySection.MyDocStyle.Layout.MSWordYAdj ?? 0.0) + yoff, pageNumber, "truncate_false"); Volian.Base.Library.BaselineMetaFile.WriteLineLegacy("WD Height={0} Width={1} scPgCnt={2} locEnd={3} pdfSz={4} xOff={5} yOff={6} ScPgNum {7}", fgPage.Height, fgPage.Width, sectPageCount, locEndOfWordDoc, pdfSize, (float)(mySection.MyDocStyle.Layout.MSWordXAdj ?? 0.0), (float)(mySection.MyDocStyle.Layout.MSWordYAdj ?? 0.0) + yoff, pageNumber, "truncate_false");
Volian.Base.Library.BaselineMetaFile.TruncateWriteLine("WD Height={0} Width={1} scPgCnt={2} locEnd={3} pdfSz={4} xOff={5} yOff={6} ScPgNum {7}", fgPage.Height, fgPage.Width, sectPageCount, Truncate(locEndOfWordDoc, 2), Truncate(pdfSize, 2), (float)(mySection.MyDocStyle.Layout.MSWordXAdj ?? 0.0), (float)(mySection.MyDocStyle.Layout.MSWordYAdj ?? 0.0) + yoff, pageNumber); Volian.Base.Library.BaselineMetaFile.WriteLineTruncate("WD Height={0} Width={1} scPgCnt={2} locEnd={3} pdfSz={4} xOff={5} yOff={6} ScPgNum {7}", fgPage.Height, fgPage.Width, sectPageCount, Truncate(locEndOfWordDoc, 2), Truncate(pdfSize, 2), (float)(mySection.MyDocStyle.Layout.MSWordXAdj ?? 0.0), (float)(mySection.MyDocStyle.Layout.MSWordYAdj ?? 0.0) + yoff, pageNumber);
AddImportedPageToLayer(cb.PdfWriter.DirectContent, _MSWordLayer, fgPage, (float)(mySection.MyDocStyle.Layout.MSWordXAdj ?? 0), (float)(mySection.MyDocStyle.Layout.MSWordYAdj ?? 0) + yoff); AddImportedPageToLayer(cb.PdfWriter.DirectContent, _MSWordLayer, fgPage, (float)(mySection.MyDocStyle.Layout.MSWordXAdj ?? 0), (float)(mySection.MyDocStyle.Layout.MSWordYAdj ?? 0) + yoff);
// B2019-102 Handle PDF Destinations for Word Sections // B2019-102 Handle PDF Destinations for Word Sections