Skip to content

Commit

Permalink
Skyline: Various fixes and improvements for tutorial screenshots (#3250)
Browse files Browse the repository at this point in the history
* Skyline: Various fixes and improvements for tutorial screenshots
- Fixed layout in ViewEditor for Japanese and Chinese
- Fixed to VolcanoPlotFormattingDlg for failure in IsPauseForScreenShots mode
- Removed screenshotlist argument from TestRunner and SkylineTester
- Fixed issue with auto-screenshot mode not saving to non-existent language folders
- Fixed ScreenshotPreviewForm startup placement in auto-size mode on 2nd monitor
- Added console output for each screenshot
- Cleaned up unnecessary Thread.Sleep() code in ScreenshotPreviewForm
- Cleaned up a bit inside ScreenshotManager and add code to ForceOnScreen() the frame to be screenshot
- Added keyboard commands (Ctrl-C and Ctrl-Shift-C) to copy new and old bitmaps respectively.
- Removed Thread.Sleep() in auto-screenshot mode for more testing
- Improved commenting in several places
  • Loading branch information
brendanx67 authored Dec 1, 2024
1 parent 51cdadf commit 4be8d27
Show file tree
Hide file tree
Showing 16 changed files with 252 additions and 150 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
<value>0</value>
</data>
<data name="availableFieldsTreeFilter.Size" type="System.Drawing.Size, System.Drawing">
<value>314, 307</value>
<value>313, 307</value>
</data>
<data name="availableFieldsTreeFilter.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
Expand All @@ -156,6 +156,12 @@
<data name="&gt;&gt;availableFieldsTreeFilter.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="panel1.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="panel1.AutoSizeMode" type="System.Windows.Forms.AutoSizeMode, System.Windows.Forms">
<value>GrowAndShrink</value>
</data>
<data name="btnAddFilter.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
Expand Down Expand Up @@ -190,10 +196,10 @@
<value>Right</value>
</data>
<data name="panel1.Location" type="System.Drawing.Point, System.Drawing">
<value>314, 0</value>
<value>313, 0</value>
</data>
<data name="panel1.Size" type="System.Drawing.Size, System.Drawing">
<value>56, 307</value>
<value>57, 307</value>
</data>
<data name="panel1.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
Expand Down Expand Up @@ -247,7 +253,7 @@
<value>0, 0</value>
</data>
<data name="dataGridViewFilter.Size" type="System.Drawing.Size, System.Drawing">
<value>475, 307</value>
<value>483, 307</value>
</data>
<data name="dataGridViewFilter.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
Expand All @@ -256,7 +262,7 @@
<value>dataGridViewFilter</value>
</data>
<data name="&gt;&gt;dataGridViewFilter.Type" xml:space="preserve">
<value>System.Windows.Forms.DataGridView, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>pwiz.Common.Controls.CommonDataGridView, pwiz.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;dataGridViewFilter.Parent" xml:space="preserve">
<value>splitContainerFilter.Panel2</value>
Expand All @@ -274,16 +280,16 @@
<value>Magenta</value>
</data>
<data name="btnDeleteFilter.Size" type="System.Drawing.Size, System.Drawing">
<value>29, 20</value>
<value>21, 20</value>
</data>
<data name="btnDeleteFilter.Text" xml:space="preserve">
<value>Delete</value>
</data>
<data name="toolStripFilter.Location" type="System.Drawing.Point, System.Drawing">
<value>475, 0</value>
<value>483, 0</value>
</data>
<data name="toolStripFilter.Size" type="System.Drawing.Size, System.Drawing">
<value>32, 307</value>
<value>24, 307</value>
</data>
<data name="toolStripFilter.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="cbxPivotIsotopeLabel.Location" type="System.Drawing.Point, System.Drawing">
<value>138, 3</value>
<value>157, 3</value>
</data>
<data name="cbxPivotIsotopeLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>117, 17</value>
Expand Down Expand Up @@ -186,8 +186,14 @@
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
<value>6, 13</value>
</data>
<data name="$this.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="$this.AutoSizeMode" type="System.Windows.Forms.AutoSizeMode, System.Windows.Forms">
<value>GrowAndShrink</value>
</data>
<data name="$this.Size" type="System.Drawing.Size, System.Drawing">
<value>259, 22</value>
<value>277, 23</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>PivotReplicateAndIsotopeLabelWidget</value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="cbxPivotIsotopeLabel.Location" type="System.Drawing.Point, System.Drawing">
<value>138, 3</value>
<value>157, 3</value>
</data>
<data name="cbxPivotIsotopeLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>117, 17</value>
Expand Down Expand Up @@ -186,8 +186,14 @@
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
<value>6, 13</value>
</data>
<data name="$this.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="$this.AutoSizeMode" type="System.Windows.Forms.AutoSizeMode, System.Windows.Forms">
<value>GrowAndShrink</value>
</data>
<data name="$this.Size" type="System.Drawing.Size, System.Drawing">
<value>259, 22</value>
<value>277, 23</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>PivotReplicateAndIsotopeLabelWidget</value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="cbxPivotIsotopeLabel.Location" type="System.Drawing.Point, System.Drawing">
<value>138, 3</value>
<value>157, 3</value>
</data>
<data name="cbxPivotIsotopeLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>117, 17</value>
Expand Down Expand Up @@ -186,8 +186,14 @@
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
<value>6, 13</value>
</data>
<data name="$this.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="$this.AutoSizeMode" type="System.Windows.Forms.AutoSizeMode, System.Windows.Forms">
<value>GrowAndShrink</value>
</data>
<data name="$this.Size" type="System.Drawing.Size, System.Drawing">
<value>259, 22</value>
<value>277, 23</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>PivotReplicateAndIsotopeLabelWidget</value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,52 @@ private T CreateDataGridViewColumn<T>(bool readOnly, string dataPropertyName, st
return column;
}

public BindingList<MatchRgbHexColor> GetCurrentBindingList()
public MatchRgbHexColor AddRow(MatchRgbHexColor match = null)
{
if (IsLastRowEmpty)
{
// Testing for screenshots needs to be able to activate
// the form which puts to focus on the grid and adds an
// empty row to the binding list. This was causing tests
// to fail when they tried to change the binding list
// with a dirty row. Silently removing the row below fixes
// the issue.
_bindingList.RaiseListChangedEvents = false;
try
{
regexColorRowGrid1.DataGridView.CancelEdit();
_bindingList.RemoveAt(_bindingList.Count - 1);
}
finally
{
_bindingList.RaiseListChangedEvents = true;
}
}

if (match == null)
return _bindingList.AddNew();

_bindingList.Add(match);
return match;
}

private bool IsLastRowEmpty => Equals(_bindingList.LastOrDefault(), MatchRgbHexColor.EMPTY);

public PointSymbol GetRowPointSymbol(int rowIndex)
{
return _bindingList[rowIndex].PointSymbol;
}

public void SetRowPointSymbol(int rowIndex, PointSymbol pointSymbol)
{
_bindingList[rowIndex].PointSymbol = pointSymbol;
}

/// <summary>
/// Used by the <see cref="ColorGrid{T}"/> but not for general use.
/// Extend the testing interface if you need more.
/// </summary>
BindingList<MatchRgbHexColor> ColorGrid<MatchRgbHexColor>.IColorGridOwner.GetCurrentBindingList()
{
return _bindingList;
}
Expand Down
2 changes: 2 additions & 0 deletions pwiz_tools/Skyline/Model/GroupComparison/MatchRgbHexColor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public enum PointSymbol
[XmlRoot(XML_ROOT)]
public class MatchRgbHexColor : RgbHexColor, ICloneable
{
public static readonly MatchRgbHexColor EMPTY = new MatchRgbHexColor();

public const string XML_ROOT = "format_detail";
private string _expression;
private bool _labeled;
Expand Down
7 changes: 2 additions & 5 deletions pwiz_tools/Skyline/SkylineTester/TabTutorials.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Windows.Forms;

Expand Down Expand Up @@ -66,10 +65,8 @@ public override bool Run()
pauseSeconds = 0;
args.Append(" pause=").Append(pauseSeconds);
}
args.Append(" screenshotlist=\"");
args.Append(Path.Combine(MainWindow.RootDir, "ScreenShotForms.txt"));
args.Append("\" test=");
args.Append(String.Join(",", testList));
args.Append(" test=");
args.Append(string.Join(",", testList));

MainWindow.AddTestRunner(args.ToString());
MainWindow.RunCommands();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ private void TestFormattingDialog()
Assert.AreEqual(Skyline.Controls.GroupComparison.GroupComparisonResources
.VolcanoPlotFormattingDlg_VolcanoPlotFormattingDlg_Protein_Expression_Formatting,
formattingDlg.Text);
var row = formattingDlg.GetCurrentBindingList().AddNew();
var row = formattingDlg.AddRow();
Assert.IsNotNull(row);
row.Expression = new MatchExpression("QE", new[] { MatchOption.PeptideSequence }).ToString();
row.PointSymbol = PointSymbol.Diamond;
row.Color = Color.FromArgb(Color.Indigo.ToArgb());
row = formattingDlg.GetCurrentBindingList().AddNew();
row = formattingDlg.AddRow();
Assert.IsNotNull(row);
row.Expression = new MatchExpression("GQ", new[] { MatchOption.PeptideSequence }).ToString();
row.PointSymbol = PointSymbol.Triangle;
Expand Down Expand Up @@ -158,11 +158,11 @@ private void TestFormattingDialog()
formattingDlg = ShowDialog<VolcanoPlotFormattingDlg>(pane.ShowFormattingDialog);
RunUI(() =>
{
Assert.AreEqual(PointSymbol.Diamond, formattingDlg.GetCurrentBindingList()[0].PointSymbol);
formattingDlg.GetCurrentBindingList()[0].PointSymbol = PointSymbol.Plus;
Assert.AreEqual(PointSymbol.Diamond, formattingDlg.GetRowPointSymbol(0));
formattingDlg.SetRowPointSymbol(0, PointSymbol.Plus);
});
WaitForGraphs();
RunUI(() => formattingDlg.GetCurrentBindingList()[0].PointSymbol =PointSymbol.Diamond);
RunUI(() => formattingDlg.SetRowPointSymbol(0, PointSymbol.Diamond));
WaitForGraphs();
OkDialog(formattingDlg, formattingDlg.OkDialog);
}
Expand Down
13 changes: 6 additions & 7 deletions pwiz_tools/Skyline/TestFunctional/VolcanoPlotFormattingTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -314,13 +314,13 @@ private void VerifyMatchExpressions(FoldChangeVolcanoPlot volcanoPlot, MatchExpr

var createExprDlg = ShowDialog<CreateMatchExpressionDlg>(() =>
{
var bindingList = formattingDlg.GetCurrentBindingList();
Assert.AreEqual(initialRowCount + index, bindingList.Count);
int rows = formattingDlg.ResultList.Count;
Assert.AreEqual(initialRowCount + index, rows);

bindingList.Add(new MatchRgbHexColor(string.Empty, exprInfo.ExpectedPointsInfo.Labeled,
formattingDlg.AddRow(new MatchRgbHexColor(string.Empty, exprInfo.ExpectedPointsInfo.Labeled,
exprInfo.ExpectedPointsInfo.Color, exprInfo.ExpectedPointsInfo.PointSymbol,
exprInfo.ExpectedPointsInfo.PointSize));
formattingDlg.ClickCreateExpression(bindingList.Count - 1);
formattingDlg.ClickCreateExpression(rows);
});

RunUI(() =>
Expand Down Expand Up @@ -456,11 +456,10 @@ private void TestMatchExpressionListDlg(FoldChangeVolcanoPlot volcanoPlot)
var formattingDlg = ShowDialog<VolcanoPlotFormattingDlg>(volcanoPlot.ShowFormattingDialog);
var createExprDlg = ShowDialog<CreateMatchExpressionDlg>(() =>
{
var bindingList = formattingDlg.GetCurrentBindingList();
bindingList.Add(new MatchRgbHexColor(string.Empty, exprInfo.ExpectedPointsInfo.Labeled,
formattingDlg.AddRow(new MatchRgbHexColor(string.Empty, exprInfo.ExpectedPointsInfo.Labeled,
exprInfo.ExpectedPointsInfo.Color, exprInfo.ExpectedPointsInfo.PointSymbol,
exprInfo.ExpectedPointsInfo.PointSize));
formattingDlg.ClickCreateExpression(bindingList.Count - 1);
formattingDlg.ClickCreateExpression(formattingDlg.ResultList.Count - 1);
});
var matchExprListDlg = ShowDialog<MatchExpressionListDlg>(createExprDlg.ClickEnterList);
RunUI(() =>
Expand Down
35 changes: 16 additions & 19 deletions pwiz_tools/Skyline/TestPerf/DiaSwathTutorialTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ public class AnalysisValues
public int[] DiffPeptideCounts;
public int UnpolishedProteins;
public int? PolishedProteins;
public double? FoldChangeProteinsMax;
public double? FoldChangeProteinsMin;

public string FastaPath =>
IsWholeProteome
Expand Down Expand Up @@ -275,6 +277,7 @@ public void TestQeData(bool fullSet)
},
DiffPeptideCounts = new[] { 139, 47, 29, 52 },
UnpolishedProteins = 9,
FoldChangeProteinsMax = 2,
};
}
}
Expand Down Expand Up @@ -1124,10 +1127,7 @@ protected override void DoTest()
var formattingDlg = ShowDialog<VolcanoPlotFormattingDlg>(volcanoPlot.ShowFormattingDialog);
ApplyFormatting(formattingDlg, "ECOLI", "128, 0, 255");
var createExprDlg = ShowDialog<CreateMatchExpressionDlg>(() =>
{
var bindingList = formattingDlg.GetCurrentBindingList();
formattingDlg.ClickCreateExpression(bindingList.Count - 1);
});
formattingDlg.ClickCreateExpression(formattingDlg.ResultList.Count - 1));
PauseForScreenShot<CreateMatchExpressionDlg>("Create Expression form", screenshotPage++);
OkDialog(createExprDlg, createExprDlg.OkDialog);

Expand Down Expand Up @@ -1212,20 +1212,17 @@ protected override void DoTest()

RestoreViewOnScreen(31);
barGraph = WaitForOpenForm<FoldChangeBarGraph>();
if (IsPauseForScreenShots)
WaitForBarGraphPoints(barGraph, _analysisValues.PolishedProteins ?? targetProteinCount);
RunUIForScreenShot(() =>
{
WaitForBarGraphPoints(barGraph, _analysisValues.PolishedProteins ?? targetProteinCount);
RunUI(() =>
{
var yScale = barGraph.ZedGraphControl.GraphPane.YAxis.Scale;
yScale.MinAuto = yScale.MaxAuto = false;
yScale.Min = -2.4;
yScale.Max = 2.2;
yScale.MajorStep = 1;
yScale.MinorStep = 0.2;
yScale.Format = "0.#";
});
}
var yScale = barGraph.ZedGraphControl.GraphPane.YAxis.Scale;
yScale.MinAuto = yScale.MaxAuto = false;
yScale.Max = _analysisValues.FoldChangeProteinsMax ?? 2.2;
yScale.Min = _analysisValues.FoldChangeProteinsMin ?? -2.4;
yScale.MajorStep = 1;
yScale.MinorStep = 0.2;
yScale.Format = "0.#";
});
PauseForGraphScreenShot("By Condition:Bar Graph - proteins", barGraph);

RunQValueSummaryTest();
Expand Down Expand Up @@ -1370,9 +1367,9 @@ private void ApplyFormatting(VolcanoPlotFormattingDlg formattingDlg, string matc
{
RunUI(() =>
{
var bindingList = formattingDlg.GetCurrentBindingList();
var color = RgbHexColor.ParseRgb(rgbText).Value;
bindingList.Add(new MatchRgbHexColor("ProteinName: " + matchText, false, color, PointSymbol.Circle, PointSize.normal));
formattingDlg.AddRow(new MatchRgbHexColor("ProteinName: " + matchText,
false, color, PointSymbol.Circle, PointSize.normal));
});
}

Expand Down
11 changes: 0 additions & 11 deletions pwiz_tools/Skyline/TestPerf/DiaUmpireTutorialTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
using pwiz.Skyline.Model;
using pwiz.Skyline.Model.AuditLog;
using pwiz.Skyline.Model.DocSettings;
using pwiz.Skyline.Model.GroupComparison;
using pwiz.Skyline.Model.Irt;
using pwiz.Skyline.Model.Results;
using pwiz.Skyline.Properties;
Expand Down Expand Up @@ -854,16 +853,6 @@ private void RestoreViewOnScreenNoSelChange(int pageName)
}
}

private void ApplyFormatting(VolcanoPlotFormattingDlg formattingDlg, string matchText, string rgbText)
{
RunUI(() =>
{
var bindingList = formattingDlg.GetCurrentBindingList();
var color = RgbHexColor.ParseRgb(rgbText).Value;
bindingList.Add(new MatchRgbHexColor("ProteinName: " + matchText, false, color, PointSymbol.Circle, PointSize.normal));
});
}

private void ValidateTargets(ref int[] targetCounts, int proteinCount, int peptideCount, int precursorCount, int transitionCount, string propName)
{
if (IsRecordMode)
Expand Down
2 changes: 1 addition & 1 deletion pwiz_tools/Skyline/TestRunner/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ public LeakTracking Min(LeakTracking lastDeltas)
"parallelmode=off;workercount=0;waitforworkers=off;keepworkerlogs=off;checkdocker=on;workername;queuehost;workerport;workertimeout;alwaysupcltpassword;" +
"coverage=off;dotcoverexe=jetbrains.dotcover.commandlinetools\\2023.3.3\\tools\\dotCover.exe;" +
"maxsecondspertest=-1;" +
"demo=off;showformnames=off;showpages=off;status=off;buildcheck=0;screenshotlist;" +
"demo=off;showformnames=off;showpages=off;status=off;buildcheck=0;" +
"quality=off;pass0=off;pass1=off;pass2=on;" +
"perftests=off;" +
"retrydatadownloads=off;" +
Expand Down
Loading

0 comments on commit 4be8d27

Please sign in to comment.