Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements to tutorial screenshot taking #3153

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pwiz_tools/Skyline/Controls/PopupPickList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@ public void ToggleItem(int iChange)
public void SetItemChecked(int i, bool checkItem)
{
SetItemCheckedInternal(i, checkItem);
pickListMulti.SelectedIndex = i;
pickListMulti.Invalidate(pickListMulti.GetItemRectangle(i));

UpdateSelectAll();
Expand Down
5 changes: 5 additions & 0 deletions pwiz_tools/Skyline/Controls/SequenceTree.cs
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@ public bool IsTipVisible
get { return _nodeTip.Visible; }
}

public Rectangle TipRect
{
get { return _nodeTip.Visible ? _nodeTip.Bounds : Rectangle.Empty; }
}

[Browsable(true)]
public event EventHandler<PickedChildrenEventArgs> PickedChildrenEvent;

Expand Down
15 changes: 15 additions & 0 deletions pwiz_tools/Skyline/EditUI/PasteDlg.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,21 @@ private DataGridView ActiveGridView
}
}

public void SelectCell(int row, int column)
{
ActiveGridView.CurrentCell = ActiveGridView.Rows[row].Cells[column];
}

public void SetColumnWidths(params int[] columnWidths)
{
for (int i = 0; i < columnWidths.Length; i++)
{
int width = columnWidths[i];
if (width != -1)
ActiveGridView.Columns[i].Width = width;
}
}

public void ShowError(PasteError pasteError)
{
_noErrors = false;
Expand Down
6 changes: 6 additions & 0 deletions pwiz_tools/Skyline/EditUI/UniquePeptidesDlg.cs
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,12 @@ public DataGridView GetDataGridView()
return dataGridView1;
}

public int SplitHeight
{
get { return splitContainer1.SplitterDistance; }
set { splitContainer1.SplitterDistance = value; }
}

public void SelectUnique(UniquenessType uniquenessType)
{
SelectPeptidesWithNumberOfMatchesAtOrBelowThreshold(1, uniquenessType);
Expand Down
10 changes: 9 additions & 1 deletion pwiz_tools/Skyline/Skyline.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4161,7 +4161,15 @@ public bool StatusContains(string format)
return statusGeneral.Text.Contains(start) && statusGeneral.Text.Contains(end);
}

public int StatusBarHeight { get { return statusGeneral.Height; } }
public int StatusBarHeight { get { return statusStrip.Height; } }

public int StatusSelectionWidth
{
get
{
return statusSequences.Width + statusPeptides.Width + statusPrecursors.Width + statusIons.Width + 20;
}
}

#endregion

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pwiz_tools/Skyline/SkylineTester/TabTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ public override bool Run()
args.Append(" pause=-1"); // Magic number that tells TestRunner to pause and show UI for a manual screenshot
if (Equals(MainWindow.RunTestMode.SelectedItem.ToString(), "Covershot"))
args.Append(" pause=-2"); // Magic number that tells TestRunner to grab tutorial cover shot then move on to next test
if (Equals(MainWindow.RunTestMode.SelectedItem.ToString(), "Auto-Screenshots"))
args.Append(" pause=-3"); // Magic number that tells TestRunner to save the screenshot to the tutorials folder

if (MainWindow.TestsRunSmallMoleculeVersions.Checked)
args.Append(" runsmallmoleculeversions=on");
Expand Down
5 changes: 3 additions & 2 deletions pwiz_tools/Skyline/TestPerf/DdaTutorialTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,11 @@ protected override void DoTest()

private Image _searchLogImage;

protected override void ProcessCoverShot(Bitmap bmp)
protected override Bitmap ProcessCoverShot(Bitmap bmp)
{
var graph = Graphics.FromImage(bmp);
graph.DrawImageUnscaled(_searchLogImage, bmp.Width - _searchLogImage.Width - 10, bmp.Height - _searchLogImage.Height - 30);
return bmp;
}

/// <summary>
Expand Down Expand Up @@ -278,7 +279,7 @@ private void TestMsFraggerSearch()
if (IsCoverShotMode)
{
RunUI(() => importPeptideSearchDlg.Width = 404);
_searchLogImage = ScreenshotManager.TakeNextShot(importPeptideSearchDlg);
_searchLogImage = ScreenshotManager.TakeShot(importPeptideSearchDlg);
Assert.IsNotNull(_searchLogImage);
}

Expand Down
5 changes: 3 additions & 2 deletions pwiz_tools/Skyline/TestPerf/DiaSearchTutorialTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,11 @@ protected override void DoTest()

private Image _searchLogImage;

protected override void ProcessCoverShot(Bitmap bmp)
protected override Bitmap ProcessCoverShot(Bitmap bmp)
{
var graph = Graphics.FromImage(bmp);
graph.DrawImageUnscaled(_searchLogImage, bmp.Width - _searchLogImage.Width - 10, bmp.Height - _searchLogImage.Height - 30);
return bmp;
}

/// <summary>
Expand Down Expand Up @@ -429,7 +430,7 @@ private void TestMsFraggerSearch()
if (IsCoverShotMode)
{
RunUI(() => importPeptideSearchDlg.Width = 404);
_searchLogImage = ScreenshotManager.TakeNextShot(importPeptideSearchDlg);
_searchLogImage = ScreenshotManager.TakeShot(importPeptideSearchDlg);
Assert.IsNotNull(_searchLogImage);
}

Expand Down
25 changes: 15 additions & 10 deletions pwiz_tools/Skyline/TestTutorial/AbsoluteQuantTutorialTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ public void TestAbsoluteQuantificationTutorial()
RunFunctionalTest();
}

protected override int[] NonScreenShotFigures => new[] { 1 };

private string GetTestPath(string relativePath)
{
var dataFolder = UseRawFiles ? "AbsoluteQuant" : "AbsoluteQuantMzml"; // Not L10N
Expand Down Expand Up @@ -158,17 +160,20 @@ protected override void DoTest()

// Importing RAW files into Skyline p. 11, 12
var importResultsDlg = ShowDialog<ImportResultsDlg>(SkylineWindow.ImportResults);
PauseForScreenShot<ImportResultsDlg>("Import Results - click OK to get shot of Import Results Files and then cancel", 11);
PauseForScreenShot<ImportResultsDlg>("Import Results", 11);

var importResultsFilesDlg = ShowDialog<OpenDataSourceDialog>(importResultsDlg.OkDialog);
RunUI(() =>
{
var rawFiles = DataSourceUtil.GetDataSources(TestFilesDirs[0].FullPath).First().Value.Skip(1);
var namedPathSets = from rawFile in rawFiles
select new KeyValuePair<string, MsDataFileUri[]>(
rawFile.GetFileNameWithoutExtension(), new[] { rawFile });
importResultsDlg.NamedPathSets = namedPathSets.ToArray();
foreach (var rawFile in rawFiles)
{
importResultsFilesDlg.SelectFile(rawFile.GetFileName());
}
});
RunDlg<ImportResultsNameDlg>(importResultsDlg.OkDialog,
PauseForScreenShot<OpenDataSourceDialog>("Import Results Files", 12);

RunDlg<ImportResultsNameDlg>(importResultsFilesDlg.Open,
importResultsNameDlg => importResultsNameDlg.NoDialog());

WaitForGraphs();
Expand Down Expand Up @@ -265,15 +270,15 @@ protected override void DoTest()

// Peptide Quantitification Settings p. 16
peptideSettingsUi = ShowDialog<PeptideSettingsUI>(SkylineWindow.ShowPeptideSettingsUI);
RunUI(() => peptideSettingsUi.SelectedTab = (PeptideSettingsUI.TABS)5);
RunUI(() => peptideSettingsUi.SelectedTab = PeptideSettingsUI.TABS.Quantification);
const string quantUnits = "fmol/ul";
RunUI(() =>
{
peptideSettingsUi.QuantRegressionFit = RegressionFit.LINEAR;
peptideSettingsUi.QuantNormalizationMethod = new NormalizationMethod.RatioToLabel(IsotopeLabelType.heavy);
peptideSettingsUi.QuantUnits = quantUnits;
});
PauseForScreenShot("Peptide Settings Quantification Tab", 16);
PauseForScreenShot<PeptideSettingsUI>("Peptide Settings Quantification Tab", 16);
OkDialog(peptideSettingsUi, peptideSettingsUi.OkDialog);

// Specify analyte concentrations of external standards
Expand Down Expand Up @@ -315,7 +320,7 @@ protected override void DoTest()
gridFloatingWindow.Top = SkylineWindow.Top;
gridFloatingWindow.Left = SkylineWindow.Right + 20;
});
PauseForScreenShot("Document grid with concentrations filled in", 17);
PauseForScreenShot<DocumentGridForm>("Document grid with concentrations filled in", 17);
}

// View the calibration curve p. 18
Expand Down Expand Up @@ -354,7 +359,7 @@ protected override void DoTest()
calibrationFloatingWindow.Top = SkylineWindow.Top;
calibrationFloatingWindow.Left = SkylineWindow.Right + 20;
});
PauseForScreenShot("View calibration curve", 18);
PauseForScreenShot<CalibrationForm>("View calibration curve", 18);
}

Assert.AreEqual(CalibrationCurveFitter.AppendUnits(QuantificationStrings.Analyte_Concentration, quantUnits), calibrationForm.ZedGraphControl.GraphPane.XAxis.Title.Text);
Expand Down
46 changes: 28 additions & 18 deletions pwiz_tools/Skyline/TestTutorial/DiaTutorialTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@
* limitations under the License.
*/

using System;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Windows.Forms;
using DigitalRune.Windows.Docking;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using pwiz.Skyline.Alerts;
using pwiz.Skyline.Controls;
Expand All @@ -48,7 +50,7 @@ public class DiaTutorialTest : AbstractFunctionalTestEx
/// to regenerate checkpoint files for non-full-import mode,
/// when something changes in the test.
/// </summary>
private bool IsFullImportMode { get { return IsRecordImported || IsCoverShotMode || IsPauseForScreenShots; } }
private bool IsFullImportMode { get { return IsRecordImported || IsCoverShotMode || IsPauseForScreenShots || IsAutoScreenShotMode; } }

private bool IsRecordImported
{
Expand All @@ -59,7 +61,7 @@ private bool IsRecordImported
public void TestDiaTutorial()
{
// Set true to look at tutorial screenshots.
// IsPauseForScreenShots = true;
IsPauseForScreenShots = true;
// IsCoverShotMode = true;
CoverShotName = "DIA";
// PauseStartPage = 36;
Expand Down Expand Up @@ -252,7 +254,7 @@ protected override void DoTest()
var peptidesPerProteinDlg = ShowDialog<AssociateProteinsDlg>(() => importPeptideSearchDlg.ClickNextButton());

WaitForCondition(() => peptidesPerProteinDlg.DocumentFinalCalculated);
PauseForScreenShot("Peptides per protein form", 25);
PauseForScreenShot<AssociateProteinsDlg>("Peptides per protein form", 25);
RunUI(() =>
{
int proteinCount, peptideCount, precursorCount, transitionCount;
Expand Down Expand Up @@ -317,15 +319,15 @@ protected override void DoTest()
});

RestoreViewOnScreen(27);
PauseForScreenShot<GraphChromatogram>("Skyline window", 27);
PauseForScreenShot("Skyline window", 27);

RunUI(() =>
{
SkylineWindow.ShowMassErrorHistogramGraph();
SkylineWindow.ChangeMassErrorTransition(TransitionMassError.all);
});
WaitForGraphs();
PauseForScreenShot("Mass Errors: Histogram metafile", 28);
PauseForGraphScreenShot("Mass Errors: Histogram metafile", FindGraphSummaryByGraphType<MassErrorHistogramGraphPane>(), 28);
RunUI(() =>
{
ValidateMassErrorStatistics(2.7, 3.3);
Expand All @@ -346,7 +348,7 @@ protected override void DoTest()
RunUI(() => SkylineWindow.SequenceTree.SelectedNode = SkylineWindow.SelectedNode.Parent);
WaitForGraphs();
RunUI(() => SkylineWindow.SequenceTree.SelectedNode = SkylineWindow.SelectedNode.Nodes[0]);
PauseForScreenShot<GraphChromatogram>("Skyline window - with manual integration and ID times", 29);
PauseForScreenShot("Skyline window - with manual integration and ID times", 29);

RunUI(() =>
{
Expand All @@ -355,7 +357,7 @@ protected override void DoTest()
});
RestoreViewOnScreen(31);
SelectNode(SrmDocument.Level.Molecules, 1); // 2nd peptide
PauseForScreenShot<GraphChromatogram>("Chromatogram graph metafile", 31);
PauseForGraphScreenShot("Chromatogram graph metafile", SkylineWindow.GetGraphChrom("Pit01"), 31);

RestoreViewOnScreen(27);
RunUI(() =>
Expand All @@ -364,7 +366,7 @@ protected override void DoTest()
SkylineWindow.Height = 700;
});
SelectNode(SrmDocument.Level.TransitionGroups, 1); // 2nd peptide - first precursor
PauseForScreenShot<GraphChromatogram>("Skyline window", 32);
PauseForScreenShot("Skyline window", 32);

SelectNode(SrmDocument.Level.Transitions, 22);

Expand All @@ -374,7 +376,8 @@ protected override void DoTest()
SkylineWindow.Height = 463;
});

PauseForScreenShot<GraphChromatogram>("Product ion chromatogram graph metafiles", 33);
PauseForGraphScreenShot("Product ion chromatogram graph metafile 1", SkylineWindow.GetGraphChrom("Pit01"), 33);
PauseForGraphScreenShot("Product ion chromatogram graph metafile 2", SkylineWindow.GetGraphChrom("Pit02"), 33);

RunUI(() =>
{
Expand All @@ -386,11 +389,19 @@ protected override void DoTest()
ChangePeakBounds("Pit01", 65.36, 66.7);
ChangePeakBounds("Pit02", 64.89, 66.2);

PauseForScreenShot<GraphChromatogram>("Chromatograms and peak areas", 34);
Func<Bitmap, Bitmap> clipChromAndPeakAreas = bmp =>
ClipSkylineWindowShotWithForms(bmp, new DockableForm[]
{
SkylineWindow.GetGraphChrom("Pit01"),
SkylineWindow.GetGraphChrom("Pit02"),
FindGraphSummaryByGraphType<AreaReplicateGraphPane>()
});

PauseForScreenShot("Chromatograms and peak areas", 34, null, clipChromAndPeakAreas);

SelectNode(SrmDocument.Level.TransitionGroups, 13);

PauseForScreenShot<GraphChromatogram>("Chromatograms and peak areas", 35);
PauseForScreenShot("Chromatograms and peak areas", 35, null, clipChromAndPeakAreas);

if (IsCoverShotMode)
{
Expand Down Expand Up @@ -442,15 +453,14 @@ protected override void DoTest()
RestoreViewOnScreen(36);
ClickChromatogram("Pit01", 70.19, 169.5E+06, PaneKey.PRECURSORS);

PauseForScreenShot<GraphFullScan>("Full-Scan MS1 spectrum metafile", 36);

PauseForGraphScreenShot("Full-Scan MS1 spectrum metafile", SkylineWindow.GraphFullScan, 36);
ClickChromatogram("Pit01", 70.79, 4.9E+05, PaneKey.PRODUCTS);

PauseForScreenShot<GraphFullScan>("Full-Scan MS/MS spectrum y10 metafile", 37);
PauseForGraphScreenShot("Full-Scan MS/MS spectrum y10 metafile", SkylineWindow.GraphFullScan, 37);

ClickChromatogram("Pit01", 70.79, 3.25E+05, PaneKey.PRODUCTS);

PauseForScreenShot<GraphFullScan>("Full-Scan MS/MS spectrum y10++ metafile", 38);
PauseForGraphScreenShot("Full-Scan MS/MS spectrum y10++ metafile", SkylineWindow.GraphFullScan, 38);

FindNode("K.ELVYETVR.V [73, 80]");
WaitForGraphs();
Expand All @@ -462,13 +472,13 @@ protected override void DoTest()
SkylineWindow.GraphFullScan.SetMzScale(new MzRange(504, 506));
SkylineWindow.GraphFullScan.Parent.Parent.Height -= 15; // Not quite as tall to fit 3 into one page
});
PauseForScreenShot<GraphFullScan>("Full-Scan MS1 spectrum metafile (1/3)", 39);
PauseForGraphScreenShot("Full-Scan MS1 spectrum metafile (1/3)", SkylineWindow.GraphFullScan, 39);

MoveNextScan(41.68);
PauseForScreenShot<GraphFullScan>("Full-Scan MS1 spectrum metafile (2/3)", 39);
PauseForGraphScreenShot("Full-Scan MS1 spectrum metafile (2/3)", SkylineWindow.GraphFullScan, 39);

MoveNextScan(41.7);
PauseForScreenShot<GraphFullScan>("Full-Scan MS1 spectrum metafile (3/3)", 39);
PauseForGraphScreenShot("Full-Scan MS1 spectrum metafile (3/3)", SkylineWindow.GraphFullScan, 39);
}

// Clear all the settings lists that were defined in this tutorial
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,12 @@ public void TestExistingExperimentsTutorial()
RunFunctionalTest();
}

protected override void ProcessCoverShot(Bitmap bmp)
protected override Bitmap ProcessCoverShot(Bitmap bmp)
{
var excelBmp = new Bitmap(TestContext.GetProjectDirectory(@"TestTutorial\ExistingQuant_excel.png"));
var graph = Graphics.FromImage(bmp);
graph.DrawImageUnscaled(excelBmp, bmp.Width - excelBmp.Width, bmp.Height - excelBmp.Height);
return bmp;
}

// Not L10N
Expand Down
Loading