diff --git a/pwiz_tools/Skyline/FileUI/ImportTransitionListColumnSelectDlg.cs b/pwiz_tools/Skyline/FileUI/ImportTransitionListColumnSelectDlg.cs index 0a772e305b7..734895fd0f6 100644 --- a/pwiz_tools/Skyline/FileUI/ImportTransitionListColumnSelectDlg.cs +++ b/pwiz_tools/Skyline/FileUI/ImportTransitionListColumnSelectDlg.cs @@ -1664,7 +1664,14 @@ private bool UpdateProteinAssociationState(AssociateProteinsMode mode) } #region testing support + public bool AssociateProteinsPreviewCompleted => checkBoxAssociateProteins.Checked && isAssociated; + + public void SetColumnWidth(int columnIndex, int width) + { + dataGrid.Columns[columnIndex].Width = width; + } + #endregion } diff --git a/pwiz_tools/Skyline/FileUI/OpenDataSourceDialog.cs b/pwiz_tools/Skyline/FileUI/OpenDataSourceDialog.cs index ada2ad26404..e579e91c0f1 100644 --- a/pwiz_tools/Skyline/FileUI/OpenDataSourceDialog.cs +++ b/pwiz_tools/Skyline/FileUI/OpenDataSourceDialog.cs @@ -284,6 +284,11 @@ public IEnumerable SelectedFiles } } + public void EnsureListViewItemVisible(int item) + { + listView.EnsureVisible(item); + } + public View ListView { get { return listView.View; } diff --git a/pwiz_tools/Skyline/SettingsUI/Irt/AddIrtPeptidesDlg.Designer.cs b/pwiz_tools/Skyline/SettingsUI/Irt/AddIrtPeptidesDlg.Designer.cs index 207e1572d20..0e4e5634da9 100644 --- a/pwiz_tools/Skyline/SettingsUI/Irt/AddIrtPeptidesDlg.Designer.cs +++ b/pwiz_tools/Skyline/SettingsUI/Irt/AddIrtPeptidesDlg.Designer.cs @@ -213,7 +213,7 @@ private void InitializeComponent() // // R // - this.R.FillWeight = 25F; + this.R.FillWeight = 20F; resources.ApplyResources(this.R, "R"); this.R.Name = "R"; this.R.ReadOnly = true; diff --git a/pwiz_tools/Skyline/SettingsUI/Irt/AddIrtPeptidesDlg.ja.resx b/pwiz_tools/Skyline/SettingsUI/Irt/AddIrtPeptidesDlg.ja.resx index f25d5ff55d5..20508998c41 100644 --- a/pwiz_tools/Skyline/SettingsUI/Irt/AddIrtPeptidesDlg.ja.resx +++ b/pwiz_tools/Skyline/SettingsUI/Irt/AddIrtPeptidesDlg.ja.resx @@ -129,7 +129,7 @@ - 497, 14 + 595, 14 75, 23 @@ -160,7 +160,7 @@ NoControl - 497, 44 + 595, 44 75, 23 @@ -199,7 +199,7 @@ ポイント数 - 32 + 80 True @@ -208,7 +208,7 @@ - 38 + 100 True @@ -217,7 +217,7 @@ R - 25 + 30 True @@ -232,7 +232,7 @@ 5, 73 - 481, 106 + 579, 106 3 @@ -280,7 +280,7 @@ 5, 306 - 481, 121 + 579, 121 5 @@ -323,7 +323,7 @@ MS/MSスキャンから計算されたより新しいiRT値は無視されます 7, 32 - 437, 69 + 535, 69 1 @@ -449,7 +449,7 @@ MS/MSスキャンから計算されたより新しいiRT値は無視されます 5, 185 - 481, 121 + 579, 121 4 @@ -492,7 +492,7 @@ MS/MSスキャンから計算されたより新しいiRT値は無視されます 7, 32 - 437, 69 + 535, 69 1 @@ -576,7 +576,7 @@ MS/MSスキャンから計算されたより新しいiRT値は無視されます 5, 427 - 481, 180 + 579, 180 6 @@ -702,7 +702,7 @@ MS/MSスキャンから計算されたより新しいiRT値は無視されます 7, 19 - 437, 56 + 535, 56 1 @@ -714,7 +714,7 @@ MS/MSスキャンから計算されたより新しいiRT値は無視されます 6, 13 - 584, 613 + 682, 613 CenterParent diff --git a/pwiz_tools/Skyline/SettingsUI/Irt/AddIrtPeptidesDlg.resx b/pwiz_tools/Skyline/SettingsUI/Irt/AddIrtPeptidesDlg.resx index 5e32e3a54a3..9b83925dac7 100644 --- a/pwiz_tools/Skyline/SettingsUI/Irt/AddIrtPeptidesDlg.resx +++ b/pwiz_tools/Skyline/SettingsUI/Irt/AddIrtPeptidesDlg.resx @@ -129,7 +129,7 @@ - 497, 14 + 595, 14 75, 23 @@ -160,7 +160,7 @@ NoControl - 497, 44 + 595, 44 75, 23 @@ -199,7 +199,7 @@ Points - 24 + 30 True @@ -208,7 +208,7 @@ Equation - 38 + 100 True @@ -217,7 +217,7 @@ R - 25 + 30 True @@ -232,7 +232,7 @@ 5, 73 - 481, 106 + 579, 106 3 @@ -280,7 +280,7 @@ 5, 306 - 481, 121 + 579, 121 5 @@ -323,7 +323,7 @@ and newer iRT values calculated from MS/MS scans ignored: 7, 32 - 437, 69 + 535, 69 1 @@ -449,7 +449,7 @@ and newer iRT values calculated from MS/MS scans ignored: 5, 185 - 481, 121 + 579, 121 4 @@ -492,7 +492,7 @@ with iRT values calculated from chromatogram peaks: 7, 32 - 437, 69 + 535, 69 1 @@ -576,7 +576,7 @@ with iRT values calculated from chromatogram peaks: 5, 427 - 481, 180 + 579, 180 6 @@ -702,7 +702,7 @@ with iRT values calculated from chromatogram peaks: 7, 19 - 437, 56 + 535, 56 1 @@ -714,7 +714,7 @@ with iRT values calculated from chromatogram peaks: 6, 13 - 584, 613 + 682, 613 CenterParent diff --git a/pwiz_tools/Skyline/SettingsUI/Irt/AddIrtPeptidesDlg.zh-CHS.resx b/pwiz_tools/Skyline/SettingsUI/Irt/AddIrtPeptidesDlg.zh-CHS.resx index 6380823f8a6..d105b38a6cf 100644 --- a/pwiz_tools/Skyline/SettingsUI/Irt/AddIrtPeptidesDlg.zh-CHS.resx +++ b/pwiz_tools/Skyline/SettingsUI/Irt/AddIrtPeptidesDlg.zh-CHS.resx @@ -129,7 +129,7 @@ - 497, 14 + 595, 14 75, 23 @@ -160,7 +160,7 @@ NoControl - 497, 44 + 595, 44 75, 23 @@ -199,7 +199,7 @@ - 32 + 30 True @@ -208,7 +208,7 @@ 方程式 - 38 + 100 True @@ -217,7 +217,7 @@ R - 25 + 30 True @@ -232,7 +232,7 @@ 5, 73 - 481, 106 + 579, 106 3 @@ -280,7 +280,7 @@ 5, 306 - 481, 121 + 579, 121 5 @@ -323,7 +323,7 @@ 7, 32 - 437, 69 + 535, 69 1 @@ -449,7 +449,7 @@ 5, 185 - 481, 121 + 579, 121 4 @@ -492,7 +492,7 @@ 7, 32 - 437, 69 + 535, 69 1 @@ -576,7 +576,7 @@ 5, 427 - 481, 180 + 579, 180 6 @@ -702,7 +702,7 @@ 7, 19 - 437, 56 + 535, 56 1 @@ -714,7 +714,7 @@ 6, 13 - 584, 613 + 682, 613 CenterParent diff --git a/pwiz_tools/Skyline/SettingsUI/ViewLibraryDlg.cs b/pwiz_tools/Skyline/SettingsUI/ViewLibraryDlg.cs index a2bd0fd22e5..908305553f2 100644 --- a/pwiz_tools/Skyline/SettingsUI/ViewLibraryDlg.cs +++ b/pwiz_tools/Skyline/SettingsUI/ViewLibraryDlg.cs @@ -137,6 +137,7 @@ private MSGraphControl GraphControl get { return msGraphExtension1.Graph; } } + public Control ListControl => listPeptide; /// /// Constructor for the View Library dialog. diff --git a/pwiz_tools/Skyline/SkylineGraphs.cs b/pwiz_tools/Skyline/SkylineGraphs.cs index 11276dfb6dc..c41428a9464 100644 --- a/pwiz_tools/Skyline/SkylineGraphs.cs +++ b/pwiz_tools/Skyline/SkylineGraphs.cs @@ -470,7 +470,6 @@ public void UpdateGraphSpectrumEnabled() private void RemoveGraphChromFromList(GraphChromatogram graphChrom) { - _listGraphChrom.Remove(graphChrom); DestroyGraphChrom(graphChrom); } @@ -517,9 +516,8 @@ private void LoadLayoutLocked(Stream layoutStream) DestroyImmediateWindow(); HideFindResults(true); - foreach (GraphChromatogram graphChrom in _listGraphChrom) + foreach (var graphChrom in _listGraphChrom.ToArray()) DestroyGraphChrom(graphChrom); - _listGraphChrom.Clear(); DestroyGraphFullScan(); dockPanel.LoadFromXml(layoutStream, DeserializeForm); // SequenceTree resizes often prior to display, so we must restore its scrolling after @@ -1948,6 +1946,8 @@ private GraphChromatogram CreateGraphChrom(string name) private void DestroyGraphChrom(GraphChromatogram graphChrom) { + _listGraphChrom.Remove(graphChrom); + // Detach event handlers and dispose graphChrom.FormClosed -= graphChromatogram_FormClosed; graphChrom.PickedPeak -= graphChromatogram_PickedPeak; diff --git a/pwiz_tools/Skyline/SkylineTester/SkylineTesterWindow.Designer.cs b/pwiz_tools/Skyline/SkylineTester/SkylineTesterWindow.Designer.cs index cc9fb297d3b..13a937c3cdb 100644 --- a/pwiz_tools/Skyline/SkylineTester/SkylineTesterWindow.Designer.cs +++ b/pwiz_tools/Skyline/SkylineTester/SkylineTesterWindow.Designer.cs @@ -3312,12 +3312,14 @@ private void InitializeComponent() this.Controls.Add(this.mainPanel); this.DoubleBuffered = true; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.KeyPreview = true; this.MainMenuStrip = this.menuStrip1; this.Margin = new System.Windows.Forms.Padding(4); this.MinimumSize = new System.Drawing.Size(700, 700); this.Name = "SkylineTesterWindow"; this.Text = "Skyline Tester"; this.Load += new System.EventHandler(this.SkylineTesterWindow_Load); + this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.SkylineTesterWindow_KeyDown); this.Move += new System.EventHandler(this.SkylineTesterWindow_Move); this.Resize += new System.EventHandler(this.SkylineTesterWindow_Resize); this.mainPanel.ResumeLayout(false); diff --git a/pwiz_tools/Skyline/SkylineTester/SkylineTesterWindow.cs b/pwiz_tools/Skyline/SkylineTester/SkylineTesterWindow.cs index 6d88a0c6a26..ba778868abf 100644 --- a/pwiz_tools/Skyline/SkylineTester/SkylineTesterWindow.cs +++ b/pwiz_tools/Skyline/SkylineTester/SkylineTesterWindow.cs @@ -426,8 +426,9 @@ private void BackgroundLoad(object sender, DoWorkEventArgs e) tutorialsTree.Nodes.Clear(); tutorialsTree.Nodes.Add(new TreeNode("Tutorial tests", tutorialNodes)); tutorialsTree.ExpandAll(); - tutorialsTree.Nodes[0].Checked = true; - TabTests.CheckAllChildNodes(tutorialsTree.Nodes[0], true); + // More common to choose just one tutorial to run on the tutorials tab + // tutorialsTree.Nodes[0].Checked = true; + // TabTests.CheckAllChildNodes(tutorialsTree.Nodes[0], true); // Add forms to forms tree view. _tabForms.CreateFormsGrid(); @@ -1995,5 +1996,19 @@ private void runMode_SelectedIndexChanged(object sender, EventArgs e) } #endregion Control events + + private void SkylineTesterWindow_KeyDown(object sender, KeyEventArgs e) + { + switch (e.KeyCode) + { + case Keys.F5: + if (e.Shift) + Stop(); + else + Run(); + e.Handled = true; + break; + } + } } } diff --git a/pwiz_tools/Skyline/TestPerf/HiResMetabolomicsTutorial.cs b/pwiz_tools/Skyline/TestPerf/HiResMetabolomicsTutorial.cs index 82848d7fd62..b8037afb430 100644 --- a/pwiz_tools/Skyline/TestPerf/HiResMetabolomicsTutorial.cs +++ b/pwiz_tools/Skyline/TestPerf/HiResMetabolomicsTutorial.cs @@ -19,10 +19,8 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using pwiz.Common.DataBinding; -using pwiz.Skyline; using pwiz.Skyline.Controls; using pwiz.Skyline.Controls.Databinding; -using pwiz.Skyline.Controls.SeqNode; using pwiz.Skyline.FileUI; using pwiz.Skyline.Model; using pwiz.Skyline.Model.DocSettings; @@ -41,6 +39,7 @@ using System.Linq; using System.Windows.Forms; using pwiz.Skyline.Alerts; +using pwiz.Skyline.Controls.Graphs.Calibration; namespace TestPerf // This would be in TestTutorials if it didn't involve a 2GB download { @@ -121,16 +120,20 @@ protected override void DoTest() var importDialog = ShowDialog(SkylineWindow.ShowPasteTransitionListDlg); - RunUI(() => importDialog.Size = new Size(600, 300)); + RunUIForScreenShot(() => ResizeFormOnScreen(importDialog, 600, 300)); PauseForScreenShot("Insert Transition List ready to accept paste of transition list", 6); var text = GetCsvFileText(GetTestPath("PUFA_TransitionList.csv")); var col4Dlg = ShowDialog(() => importDialog.TransitionListText = text); - RunUI(() => { - col4Dlg.radioMolecule.PerformClick(); + RunUI(col4Dlg.radioMolecule.PerformClick); + RunUIForScreenShot(() => + { + col4Dlg.SetColumnWidth(0, 120); // To show "Molecule List Name" fully + col4Dlg.SetColumnWidth(1, 125); // To show the precursor names fully + col4Dlg.SetColumnWidth(2, 120); // To show "Molecule Formula" fully + col4Dlg.SetColumnWidth(5, 135); // To reduce wrapping to just 2 rows }); - PauseForScreenShot("Insert Transition List column picker", 6); var errDlg = ShowDialog(col4Dlg.CheckForErrors); @@ -144,7 +147,7 @@ protected override void DoTest() OkDialog(col4Dlg, col4Dlg.OkDialog); var autoSelectDlg = WaitForOpenForm(); - PauseForScreenShot("Auto-select query", 8); + PauseForScreenShot("Auto-select query", 8); OkDialog(autoSelectDlg, autoSelectDlg.OkDialog); docTargets = WaitForDocumentChange(docTargets); @@ -160,21 +163,14 @@ protected override void DoTest() }); RestoreViewOnScreen(5); - PauseForScreenShot("Skyline with 14 transition - show the right-click menu for setting DHA to be a surrogate standard", 9); + PauseForScreenShot("Skyline with 14 transition - show the right-click menu for setting DHA to be a surrogate standard", 9); // Set the standard type of the surrogate standards to StandardType.SURROGATE_STANDARD - RunUI(() => - { - List pathsToSelect = SkylineWindow.SequenceTree.Nodes.OfType() - .SelectMany(peptideGroup => peptideGroup.Nodes.OfType()) - .Where(peptideTreeNode => peptideTreeNode.DocNode.RawTextId.Contains("(DHA)")) - .Select(treeNode => treeNode.Path) - .ToList(); - SkylineWindow.SequenceTree.SelectedPaths = pathsToSelect; - SkylineWindow.SetStandardType(StandardType.SURROGATE_STANDARD); - }); - + SelectNode(SrmDocument.Level.Molecules, 3); + // TODO: Show right-click menu with "Surrogate Standard" selected + RunUI(() => SkylineWindow.SetStandardType(StandardType.SURROGATE_STANDARD)); + PauseForScreenShot("Skyline with 4 molecules and one set as surrogate standard"); RunUI(() => SkylineWindow.SaveDocument(GetTestPath("FattyAcids_demo.sky"))); using (new WaitDocumentChange(1, true)) @@ -189,14 +185,13 @@ protected override void DoTest() }); PauseForScreenShot("Import Results Files form", 10); OkDialog(openDataSourceDialog1, openDataSourceDialog1.Open); - OkDialog(importResultsDlg1,importResultsDlg1.OkDialog); } SelectNode(SrmDocument.Level.Molecules, 0); SelectNode(SrmDocument.Level.MoleculeGroups, 0); - - PauseForScreenShot("Skyline window multi-target graph", 11); + RunUI(SkylineWindow.CollapsePrecursors); + PauseForScreenShot("Skyline window multi-target graph", 11); var docResults = SkylineWindow.Document; @@ -239,7 +234,7 @@ protected override void DoTest() RunUI(() => documentGrid.DataboundGridControl.ChooseView(new ViewName(ViewGroup.BUILT_IN.Id, Resources.SkylineViewContext_GetDocumentGridRowSources_Molecules))); } - PauseForScreenShot("Skyline window multi-replicate layout", 12); + PauseForScreenShot("Skyline window multi-replicate layout", 12); if (IsCoverShotMode) { @@ -277,7 +272,7 @@ protected override void DoTest() RunUI(() => { - peptideSettingsUI.SelectedTab = PeptideSettingsUI.TABS.Quantification - 2; + peptideSettingsUI.SelectedTab = PeptideSettingsUI.TABS.Quantification; peptideSettingsUI.QuantRegressionFit = RegressionFit.LINEAR_THROUGH_ZERO; peptideSettingsUI.QuantNormalizationMethod = new NormalizationMethod.RatioToLabel(IsotopeLabelType.heavy); @@ -348,9 +343,8 @@ protected override void DoTest() RunUI(() => SkylineWindow.ShowCalibrationForm()); SelectNode(SrmDocument.Level.Molecules, 0); WaitForGraphs(); - PauseForScreenShot("Calibration curve", 15); + PauseForScreenShot("Calibration curve", 15); } - } } } diff --git a/pwiz_tools/Skyline/TestPerf/HiResMetabolomicsViews.data/cover.view b/pwiz_tools/Skyline/TestPerf/HiResMetabolomicsViews.data/cover.view new file mode 100644 index 00000000000..ba215d235ef --- /dev/null +++ b/pwiz_tools/Skyline/TestPerf/HiResMetabolomicsViews.data/cover.view @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pwiz_tools/Skyline/TestPerf/HiResMetabolomicsViews.data/p05.view b/pwiz_tools/Skyline/TestPerf/HiResMetabolomicsViews.data/p05.view new file mode 100644 index 00000000000..ba99a7c01f6 --- /dev/null +++ b/pwiz_tools/Skyline/TestPerf/HiResMetabolomicsViews.data/p05.view @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pwiz_tools/Skyline/TestPerf/HiResMetabolomicsViews.data/p09.view b/pwiz_tools/Skyline/TestPerf/HiResMetabolomicsViews.data/p09.view new file mode 100644 index 00000000000..df3d9822ec8 --- /dev/null +++ b/pwiz_tools/Skyline/TestPerf/HiResMetabolomicsViews.data/p09.view @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pwiz_tools/Skyline/TestPerf/HiResMetabolomicsViews.data/p14.view b/pwiz_tools/Skyline/TestPerf/HiResMetabolomicsViews.data/p14.view new file mode 100644 index 00000000000..56d233e224b --- /dev/null +++ b/pwiz_tools/Skyline/TestPerf/HiResMetabolomicsViews.data/p14.view @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pwiz_tools/Skyline/TestPerf/HiResMetabolomicsViews.data/p15.view b/pwiz_tools/Skyline/TestPerf/HiResMetabolomicsViews.data/p15.view new file mode 100644 index 00000000000..bbb3176a23e --- /dev/null +++ b/pwiz_tools/Skyline/TestPerf/HiResMetabolomicsViews.data/p15.view @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pwiz_tools/Skyline/TestPerf/HiResMetabolomicsViews.zip b/pwiz_tools/Skyline/TestPerf/HiResMetabolomicsViews.zip deleted file mode 100644 index 0aefcde9776..00000000000 Binary files a/pwiz_tools/Skyline/TestPerf/HiResMetabolomicsViews.zip and /dev/null differ diff --git a/pwiz_tools/Skyline/TestTutorial/IrtTutorialTest.cs b/pwiz_tools/Skyline/TestTutorial/IrtTutorialTest.cs index a2572eafb7d..0583390327d 100644 --- a/pwiz_tools/Skyline/TestTutorial/IrtTutorialTest.cs +++ b/pwiz_tools/Skyline/TestTutorial/IrtTutorialTest.cs @@ -110,7 +110,7 @@ protected override void DoTest() }); // Page 3. - PauseForScreenShot("RT graph metafile", 3); // Peptide RT graph + PauseForRetentionTimeGraphScreenShot("RT graph metafile", 3); // Peptide RT graph RunUI(() => { @@ -224,7 +224,7 @@ protected override void DoTest() WaitForRegression(); RestoreViewOnScreen(9); - PauseForScreenShot("Retention Times Regression graph metafile", 9); // RT Regression graph + PauseForRetentionTimeGraphScreenShot("Retention Times Regression graph metafile", 9); // RT Regression graph RunUI(() => { @@ -261,7 +261,7 @@ protected override void DoTest() WaitForProteinMetadataBackgroundLoaderCompletedUI(); // let peptide metadata background loader do its work RestoreViewOnScreen(10); - PauseForScreenShot("Targets tree clipped out of main window", 10); // Target tree + PauseForTargetsScreenShot("Targets tree clipped out of main window"); // Target tree RunUI(() => { @@ -298,7 +298,7 @@ protected override void DoTest() regressionDlg.SetTimeWindow(5); }); - PauseForScreenShot("Edit Retention Time Predictor form", 11); // Edit retention time predictor form + PauseForScreenShot("Edit Retention Time Predictor form", 11); // Edit retention time predictor form OkDialog(regressionDlg, regressionDlg.OkDialog); OkDialog(peptideSettingsUI1, peptideSettingsUI2.OkDialog); @@ -333,7 +333,7 @@ protected override void DoTest() RunUI(SkylineWindow.ShowRTRegressionGraphScoreToRun); WaitForRegression(); - PauseForScreenShot("RT Regression graph metafile", 14); + PauseForRetentionTimeGraphScreenShot("RT Regression graph metafile", 14); RunUI(() => { @@ -389,11 +389,11 @@ protected override void DoTest() if (i == 1) { - PauseForScreenShot("Chromatogram graph metafile (1 of 2)", 16); // Chromatogram graph + PauseForChromGraphScreenShot("Chromatogram graph metafile (1 of 2)"); // Chromatogram graph } if (i == 2) { - PauseForScreenShot("Chromatogram graph metafile (2 of 2)", 16); + PauseForChromGraphScreenShot("Chromatogram graph metafile (2 of 2)"); } if (i == 3) { @@ -464,7 +464,7 @@ protected override void DoTest() // Check the RT regression, p. 19 WaitForRegression(); - PauseForScreenShot("RT Regression graph metafile", 19); + PauseForRetentionTimeGraphScreenShot("RT Regression graph metafile", 19); RunUI(() => { @@ -509,7 +509,7 @@ protected override void DoTest() // Verify regression graph, p. 19 RunUI(SkylineWindow.ShowRTRegressionGraphScoreToRun); WaitForRegression(); - PauseForScreenShot("RT Regression graph metafile", 22); + PauseForRetentionTimeGraphScreenShot("RT Regression graph metafile", 22); RunUI(() => { VerifyRTRegression(0.40, 24.77, 0.9998); @@ -525,7 +525,7 @@ protected override void DoTest() }); WaitForGraphs(); - PauseForScreenShot("RT Scheduling graph metafile", 23); + PauseForRetentionTimeGraphScreenShot("RT Scheduling graph metafile", 23); // Export new 90-minute scheduled transition list, p. 22 const string scheduledBasename = "iRT Human+Standard"; // Not L10N @@ -560,7 +560,7 @@ protected override void DoTest() RunUI(SkylineWindow.ShowRTRegressionGraphScoreToRun); WaitForRegression(); - PauseForScreenShot("RT Regression graph metafile", 26); + PauseForRetentionTimeGraphScreenShot("RT Regression graph metafile", 26); // Review regression and outliers, p. 24 RunUI(() => @@ -574,8 +574,9 @@ protected override void DoTest() thresholdDlg.Threshold = 0.998; thresholdDlg.OkDialog(); }); + WaitForRegression(); - PauseForScreenShot("RT Regression graph metafile", 27); + PauseForRetentionTimeGraphScreenShot("RT Regression graph metafile", 27); // Verify 2 outliers highlighted and removed, p. 25 WaitForConditionUI(() => SkylineWindow.RTGraphController.Outliers.Length == 2); @@ -588,7 +589,7 @@ protected override void DoTest() }); WaitForRegression(); - PauseForScreenShot("RT Regression graph metafile", 28); + PauseForRetentionTimeGraphScreenShot("RT Regression graph metafile", 28); if (IsCoverShotMode) { @@ -648,7 +649,7 @@ protected override void DoTest() }); WaitForGraphs(); - PauseForScreenShot("Chromatogram graph metafile", 29); // Chromatogram graph + PauseForChromGraphScreenShot("Chromatogram graph metafile"); // Chromatogram graph RunUI(() => { diff --git a/pwiz_tools/Skyline/TestTutorial/LibraryExplorerTutorialTest.cs b/pwiz_tools/Skyline/TestTutorial/LibraryExplorerTutorialTest.cs index f1b530dcbc7..e6dc972a581 100644 --- a/pwiz_tools/Skyline/TestTutorial/LibraryExplorerTutorialTest.cs +++ b/pwiz_tools/Skyline/TestTutorial/LibraryExplorerTutorialTest.cs @@ -20,9 +20,9 @@ using System.Drawing; using System.IO; using System.Linq; +using System.Windows.Forms; using Microsoft.VisualStudio.TestTools.UnitTesting; using pwiz.Common.SystemUtil; -using pwiz.Skyline.Controls.Graphs; using pwiz.Skyline.Model; using pwiz.Skyline.Model.Lib; using pwiz.Skyline.Model.Proteome; @@ -111,7 +111,7 @@ protected override void DoTest() viewLibraryDlg.FilterString = "Q"; // Not L10N Assert.AreEqual(7, viewLibraryDlg.PeptideDisplayCount); }); - PauseForScreenShot("Library Explorere filtered for peptides beginning with Q", 6); + PauseForScreenShot("Library Explorer filtered for peptides beginning with Q", 6); RunUI(() => { @@ -174,7 +174,14 @@ protected override void DoTest() Assert.IsTrue(WaitForCondition(() => SkylineWindow.Document.Settings.PeptideSettings.Modifications.StaticModifications.Count > 0 && SkylineWindow.Document.Settings.PeptideSettings.Modifications.AllHeavyModifications.Any())); - PauseForScreenShot("Peptide list clipped from Library Explorer", 11); + RunUIForScreenShot(() => + { + // CONSIDER: Find a way to scroll without changing selection. SetScrollPos does not work on the list + int entryCount = viewLibraryDlg.PeptideDisplayCount; + viewLibraryDlg.SelectedIndex = entryCount - 1; + viewLibraryDlg.SelectedIndex = entryCount - 19; + }); + PauseForScreenShot(viewLibraryDlg.ListControl,"Peptide list clipped from Library Explorer", 11); if (IsCoverShotMode) { @@ -230,7 +237,15 @@ protected override void DoTest() SkylineWindow.Size = new Size(918, 553); }); RestoreViewOnScreen(12); + Point locationSaved = Point.Empty; + RunUIForScreenShot(() => + { + // Move the library explorer out of the way for the screenshot + locationSaved = viewLibraryDlg.Location; + viewLibraryDlg.Location = new Point(SkylineWindow.Right + 20, SkylineWindow.Top); + }); PauseForScreenShot("Main window", 12); + RunUIForScreenShot(() => viewLibraryDlg.Location = locationSaved); // Adding DNAGAATEEFIKR++ (has ok) const string peptideSequence3 = "DNAGAATEEFIKR"; // Not L10N @@ -321,13 +336,13 @@ protected override void DoTest() Assert.AreEqual(2, viewLibraryDlg1.PeptideDisplayCount); Assert.AreEqual(countLabels1, viewLibraryDlg1.GraphItem.IonLabels.Count()); }); - PauseForScreenShot("Spectrum graph metafile", 16); // p. 16, figure 1a + PauseForGraphScreenShot("Spectrum graph metafile", viewLibraryDlg1.GraphExtensionControl, 16); // p. 16, figure 1a RunUI(() => { viewLibraryDlg1.SelectedIndex = 1; Assert.AreEqual(countLabels2, viewLibraryDlg1.GraphItem.IonLabels.Count()); }); - PauseForScreenShot("Spectrum graph metafile", 16); // p. 16, figure 1b + PauseForGraphScreenShot("Spectrum graph metafile", viewLibraryDlg1.GraphExtensionControl, 16); // p. 16, figure 1b docInitial = SkylineWindow.Document; @@ -364,7 +379,7 @@ protected override void DoTest() Assert.IsTrue(labelsPhospho.Contains(label => label.Contains(string.Format("{0} {1}", IonType.precursor.GetLocalizedString(), lossText)))); Assert.AreEqual(countLabels1 + countLossLabels1 + countPrecursors1, labelsPhospho.Count); }); - PauseForScreenShot("Spectrum graph metafile", 18); // p. 18, figure 1a. + PauseForGraphScreenShot("Spectrum graph metafile", viewLibraryDlg1.GraphExtensionControl, 18); // p. 18, figure 1a. RunUI(() => { @@ -374,7 +389,7 @@ protected override void DoTest() Assert.IsTrue(labelsPhospho.Contains(label => label.Contains(string.Format("{0} {1}", IonType.precursor.GetLocalizedString(), lossText)))); Assert.AreEqual(countLabels2 + countLossLabels2 + countPrecursors2, labelsPhospho.Count); }); - PauseForScreenShot("Spectrum graph metafile", 18); // p. 18, figure 1b. + PauseForGraphScreenShot("Spectrum graph metafile", viewLibraryDlg1.GraphExtensionControl, 18); // p. 18, figure 1b. // Matching Library Peptides to Proteins p. 18 var peptideSettingsUI3 = ShowDialog(SkylineWindow.ShowPeptideSettingsUI); @@ -432,7 +447,7 @@ protected override void DoTest() { var msgDlg = ShowDialog(filterMatchedPeptidesDlg.OkDialog); - PauseForScreenShot("Message form", 20); // p. 20, figure 2 + PauseForScreenShot("Message form", 20); // p. 20, figure 2 OkDialog(msgDlg, msgDlg.Btn1Click); } @@ -443,6 +458,7 @@ protected override void DoTest() AssertEx.IsDocumentState(docProteins, null, 250, 346, 347, 1041); RestoreViewOnScreen(21); + RunUIForScreenShot(() => SkylineWindow.SequenceTree.SetScrollPos(Orientation.Horizontal, 0)); PauseForScreenShot("Main window", 21); OkDialog(viewLibraryDlg, viewLibraryDlg.Close); diff --git a/pwiz_tools/Skyline/TestTutorial/SmallMolMethodDevCEOptTutorial.cs b/pwiz_tools/Skyline/TestTutorial/SmallMolMethodDevCEOptTutorial.cs index 1b347d42ac7..97c8152b493 100644 --- a/pwiz_tools/Skyline/TestTutorial/SmallMolMethodDevCEOptTutorial.cs +++ b/pwiz_tools/Skyline/TestTutorial/SmallMolMethodDevCEOptTutorial.cs @@ -23,7 +23,6 @@ using System.IO; using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; -using pwiz.Skyline; using pwiz.Skyline.Controls; using pwiz.Skyline.Controls.Databinding; using pwiz.Skyline.Controls.Graphs; @@ -45,7 +44,7 @@ namespace pwiz.SkylineTestTutorial { [TestClass] - public class SmallMolMethodDevCEOptTutorialTest : AbstractFunctionalTest + public class SmallMolMethodDevCEOptTutorialTest : AbstractFunctionalTestEx { protected override bool UseRawFiles { @@ -90,6 +89,7 @@ protected override void DoTest() SetCsvFileClipboardText(GetTestPath("Energy_TransitionList.csv")); var confirmHeadersDlg = ShowDialog(SkylineWindow.Paste); + RunUIForScreenShot(() => ResizeFormOnScreen(confirmHeadersDlg, 1070, null)); PauseForScreenShot("Confirming column headers", 5); OkDialog(confirmHeadersDlg, confirmHeadersDlg.OkDialog); @@ -98,7 +98,7 @@ protected override void DoTest() AdjustSequenceTreePanelWidth(); }); - PauseForScreenShot("Main window after paste from csv", 5); + PauseForScreenShot("Main window after paste from csv", 5); var docTargets = WaitForDocumentChange(doc); @@ -181,14 +181,16 @@ protected override void DoTest() SelectNode(SrmDocument.Level.Molecules, 0); SelectNode(SrmDocument.Level.MoleculeGroups, 0); + FocusDocument(); - PauseForScreenShot("Skyline window multi-target graph", 13); + PauseForScreenShot("Skyline window multi-target graph", 13); // Renaming replicates { var manageResultsDlg = ShowDialog(SkylineWindow.ManageResults); string[] repNames = new[] { "2 min", "5 min" }; RunUI(() => manageResultsDlg.Left = SkylineWindow.Right + 50); + RunUIForScreenShot(() => manageResultsDlg.Width += 40); // Easier to get both forms if this is wider for (var i = 0; i < 2; i++) { doc = SkylineWindow.Document; @@ -202,13 +204,14 @@ protected override void DoTest() var renameDlg = ShowDialog(manageResultsDlg.RenameResult); RunUI(() => renameDlg.ReplicateName = repNames[i]); if (i == 0) - PauseForScreenShot("Manage Results and Rename Replicate (PrtScn and select in Paint)", 14); + PauseForScreenShot("Manage Results and Rename Replicate (PrtScn and select in Paint)", 14); OkDialog(renameDlg, renameDlg.OkDialog); } OkDialog(manageResultsDlg, manageResultsDlg.OkDialog); } - PauseForScreenShot("Skyline window (renamed)", 15); + FocusDocument(); + PauseForScreenShot("Skyline window (renamed)", 15); var docResults = SkylineWindow.Document; @@ -241,7 +244,7 @@ protected override void DoTest() AdjustSequenceTreePanelWidth(true); }); - PauseForScreenShot("Skyline window multi-replicate layout", 16); + PauseForScreenShot("Skyline window multi-replicate layout", 16); // Set zoom to show better peak separation in 5 minute run for (var i = 0; i < 2; i++) @@ -250,7 +253,7 @@ protected override void DoTest() RunUI(() => SkylineWindow.GraphChromatograms.ToArray()[i].ZoomTo(.8, 1.8, 1.39e+8)); WaitForGraphs(); } - PauseForScreenShot("Skyline window showing relative peak separation", 17); + PauseForScreenShot("Skyline window showing relative peak separation", 17); // Set time window { @@ -258,7 +261,7 @@ protected override void DoTest() RunUI(() => { // ReSharper disable once RedundantCast - peptideSettingsDlg.SelectedTab = (PeptideSettingsUI.TABS)0; //regular enum does not work because of the hidden tabs in the Small Molecule mode. + peptideSettingsDlg.SelectedTab = PeptideSettingsUI.TABS.Prediction; //regular enum does not work because of the hidden tabs in the Small Molecule mode. peptideSettingsDlg.TimeWindow = 1; }); PauseForScreenShot("Setting scheduled transition list time window", 18); @@ -312,7 +315,7 @@ protected override void DoTest() var manageResultsDlg = ShowDialog(SkylineWindow.ManageResults); SelectReplicate(manageResultsDlg, 0); - PauseForScreenShot("Manage Results removing 2 min", 21); + PauseForScreenShot("Manage Results removing 2 min", 21); RunUI(manageResultsDlg.RemoveReplicates); @@ -326,7 +329,7 @@ protected override void DoTest() }); } - PauseForScreenShot("Manage Results replicate renamed", 22); + PauseForScreenShot("Manage Results replicate renamed", 22); OkDialog(manageResultsDlg, manageResultsDlg.OkDialog); } @@ -340,7 +343,7 @@ protected override void DoTest() molNode.Nodes[1].Expand(); SkylineWindow.ArrangeGraphsTabbed(); }); - PauseForScreenShot("Skyline window with calibration data", 23); + PauseForScreenShot("Skyline window with calibration data", 23); // Linearity var documentGrid = ShowDialog(() => SkylineWindow.ShowDocumentGrid(true)); @@ -368,7 +371,7 @@ protected override void DoTest() RunUI(() => { // ReSharper disable once RedundantCast - peptideSettingsUI.SelectedTab = (PeptideSettingsUI.TABS)3; + peptideSettingsUI.SelectedTab = PeptideSettingsUI.TABS.Quantification; peptideSettingsUI.QuantRegressionFit = RegressionFit.LINEAR; peptideSettingsUI.QuantNormalizationMethod = new NormalizationMethod.RatioToLabel(IsotopeLabelType.heavy); @@ -453,7 +456,7 @@ protected override void DoTest() OkDialog(openDataSourceDialog1, openDataSourceDialog1.Open); } - PauseForScreenShot("Skyline shows new replicate \"CE Optimization\"", 32); + PauseForScreenShot("Skyline shows new replicate \"CE Optimization\"", 32); RunUI(() => { SkylineWindow.Size = new Size(1600, 960); @@ -463,19 +466,19 @@ protected override void DoTest() SkylineWindow.ShowSingleTransition(); SkylineWindow.ShowSplitChromatogramGraph(true); }); - PauseForScreenShot("Split graph", 33); + PauseForScreenShot("Split graph", 33); RunUI(() => { SkylineWindow.ShowPeakAreaLegend(false); }); - PauseForScreenShot("No legend", 34); + PauseForScreenShot("No legend", 34); TestAsymmetricOptimization(); // Show Pentose-P SelectNode(SrmDocument.Level.Molecules, 6); - PauseForScreenShot("Pentose-P", 35); + PauseForScreenShot("Pentose-P", 35); if (IsCoverShotMode) { diff --git a/pwiz_tools/Skyline/TestTutorial/SmallMoleculesQuantificationTutorial.cs b/pwiz_tools/Skyline/TestTutorial/SmallMoleculesQuantificationTutorial.cs index 92c9e15459c..44d40b4774d 100644 --- a/pwiz_tools/Skyline/TestTutorial/SmallMoleculesQuantificationTutorial.cs +++ b/pwiz_tools/Skyline/TestTutorial/SmallMoleculesQuantificationTutorial.cs @@ -92,10 +92,9 @@ protected override void DoTest() var doc = SkylineWindow.Document; var importDialog = ShowDialog(SkylineWindow.ShowPasteTransitionListDlg); - RunUI(() => importDialog.Size = new Size(600, 300)); + RunUIForScreenShot(() => ResizeFormOnScreen(importDialog, 600, 300)); PauseForScreenShot("Insert Transition List form", 4); - var text = "DrugX,Drug,light,283.04,1,129.96,1,26,16,2.7\r\nDrugX,Drug,heavy,286.04,1,133.00,1,26,16,2.7\r\n"; text = text.Replace(',', TextUtil.CsvSeparator).Replace(".", LocalizationHelper.CurrentCulture.NumberFormat.NumberDecimalSeparator); var col4Dlg = ShowDialog(() => importDialog.TransitionListText = text); @@ -326,6 +325,8 @@ protected override void DoTest() documentGrid.DataGridView.SendPaste(); }); + RunUIForScreenShot(() => ResizeFloatingFrame(documentGrid, null, 857)); + //SetDocumentGridSampleTypesAndConcentrations(sampleTypes); PauseForScreenShot("Document Grid - sample types - enlarge for screenshot so rows 95_0_1_1_00_1021523636 to end can be seen", 22); foreach (var chromatogramSet in SkylineWindow.Document.MeasuredResults.Chromatograms) @@ -365,7 +366,7 @@ protected override void DoTest() PauseForScreenShot("Custom document grid -scroll to end so same rows are in screenshot", 23); SetDocumentGridExcludeFromCalibration(); - PauseForScreenShot("Calibration Curve - outliers disabled", 24); + PauseForGraphScreenShot("Calibration Curve - outliers disabled", 24); if (IsCoverShotMode) { @@ -401,7 +402,8 @@ protected override void DoTest() documentGrid.DataGridView.Sort(colReplicate, ListSortDirection.Ascending); }); - PauseForScreenShot("Document Grid - Molecule Ratio Results - manually widen to show all columns", 25); + RunUIForScreenShot(() => ResizeFloatingFrame(documentGrid, 780, null)); + PauseForScreenShot("Document Grid - Molecule Ratio Results", 25); RunUI(() => { Settings.Default.CalibrationCurveOptions = Settings.Default.CalibrationCurveOptions @@ -410,7 +412,7 @@ protected override void DoTest() }); var calibrationForm = FindOpenForm(); - RunUI(()=>calibrationForm.UpdateUI(false)); + RunUI(() => calibrationForm.UpdateUI(false)); PauseForScreenShot("Calibration Curve: Log", 26); } @@ -436,8 +438,16 @@ private void ImportReplicates(bool isFirstPass) RunUI(() => { openDataSourceDialog1.CurrentDirectory = new MsDataFilePath(GetTestPath()); - openDataSourceDialog1.SelectAllFileType(ExtWatersRaw, - path => isFirstPass ? firstPassMatches.Any(path.Contains) : !firstPassMatches.Any(path.Contains)); + openDataSourceDialog1.SelectAllFileType(ExtWatersRaw, path => isFirstPass + ? firstPassMatches.Any(path.Contains) + : !firstPassMatches.Any(path.Contains)); + }); + RunUIForScreenShot(() => + { + openDataSourceDialog1.Size = new Size(800, 430); + int lastIndex = openDataSourceDialog1.ListItemNames.Count() - 1; + openDataSourceDialog1.EnsureListViewItemVisible(lastIndex); + openDataSourceDialog1.EnsureListViewItemVisible(lastIndex - 46); }); if (isFirstPass) { diff --git a/pwiz_tools/Skyline/TestTutorial/SmallMoleculesTutorial.cs b/pwiz_tools/Skyline/TestTutorial/SmallMoleculesTutorial.cs index 19bd6f5afaf..dc2c8f81cea 100644 --- a/pwiz_tools/Skyline/TestTutorial/SmallMoleculesTutorial.cs +++ b/pwiz_tools/Skyline/TestTutorial/SmallMoleculesTutorial.cs @@ -156,7 +156,7 @@ protected override void DoTest() openDataSourceDialog1.CurrentDirectory = new MsDataFilePath(GetTestPath()); openDataSourceDialog1.SelectAllFileType(ExtWatersRaw); }); - PauseForScreenShot("Import Results Files form", 7); + PauseForScreenShot("Import Results Files form", 7); OkDialog(openDataSourceDialog1, openDataSourceDialog1.Open); var importResultsNameDlg = ShowDialog(importResultsDlg1.OkDialog); @@ -165,7 +165,7 @@ protected override void DoTest() SelectNode(SrmDocument.Level.MoleculeGroups, 0); - PauseForScreenShot("Skyline window multi-target graph", 9); + PauseForScreenShot("Skyline window multi-target graph", 9); var docResults = SkylineWindow.Document; @@ -204,7 +204,7 @@ protected override void DoTest() if (!string.IsNullOrEmpty(msg)) Assert.IsTrue(string.IsNullOrEmpty(msg), msg); RestoreViewOnScreen(9); - PauseForScreenShot("Skyline window multi-replicate layout", 10); + PauseForScreenShot("Skyline window multi-replicate layout", 10); if (IsCoverShotMode) { diff --git a/pwiz_tools/Skyline/TestUtil/AbstractFunctionalTestEx.cs b/pwiz_tools/Skyline/TestUtil/AbstractFunctionalTestEx.cs index 945599088c8..8d0068cea90 100644 --- a/pwiz_tools/Skyline/TestUtil/AbstractFunctionalTestEx.cs +++ b/pwiz_tools/Skyline/TestUtil/AbstractFunctionalTestEx.cs @@ -27,10 +27,12 @@ using pwiz.Skyline.Controls.Graphs; using System.Windows.Forms; using System.Xml.Serialization; +using DigitalRune.Windows.Docking; using pwiz.Common.DataBinding; using pwiz.Common.DataBinding.Controls.Editor; using pwiz.MSGraph; using pwiz.ProteowizardWrapper; +using pwiz.Skyline; using pwiz.Skyline.Alerts; using pwiz.Skyline.Controls.Databinding; using pwiz.Skyline.Controls.GroupComparison; @@ -45,6 +47,7 @@ using pwiz.Skyline.Properties; using pwiz.Skyline.SettingsUI; using pwiz.Skyline.ToolsUI; +using pwiz.Skyline.Util; using ZedGraph; namespace pwiz.SkylineTestUtil @@ -174,7 +177,7 @@ public void ImportResultsAsync(string[] dataFiles, LockMassParameters lockMassPa { var doc = SkylineWindow.Document; ImportResultsDlg importResultsDlg; - if (!Skyline.SkylineWindow.ShouldPromptForDecoys(SkylineWindow.Document)) + if (!SkylineWindow.ShouldPromptForDecoys(SkylineWindow.Document)) { importResultsDlg = ShowDialog(SkylineWindow.ImportResults); } @@ -229,13 +232,6 @@ public void ImportResultsAsync(string[] dataFiles, LockMassParameters lockMassPa WaitForDocumentChange(doc); } - public void WaitForRegression() - { - WaitForGraphs(); - WaitForConditionUI(() => SkylineWindow.RTGraphController != null); - WaitForPaneCondition(SkylineWindow.RTGraphController.GraphSummary, pane => !pane.IsCalculating); - } - /// /// Wait for the built library to be loaded, and contain the expected /// number of spectra. @@ -486,7 +482,7 @@ public Tool( { Settings.Default.ToolList.Clear(); - _movedDirectory = new MovedDirectory(ToolDescriptionHelpers.GetToolsDirectory(), Skyline.Program.StressTest); + _movedDirectory = new MovedDirectory(ToolDescriptionHelpers.GetToolsDirectory(), Program.StressTest); _toolPath = toolPath; RunDlg(SkylineWindow.ShowConfigureToolsDlg, configureToolsDlg => { @@ -618,6 +614,26 @@ private static void ZoomAxis(ZedGraphControl graphControl, Func( diff --git a/pwiz_tools/Skyline/TestUtil/ScreenshotManager.cs b/pwiz_tools/Skyline/TestUtil/ScreenshotManager.cs index a1d9ef4aaa5..efa43c68046 100644 --- a/pwiz_tools/Skyline/TestUtil/ScreenshotManager.cs +++ b/pwiz_tools/Skyline/TestUtil/ScreenshotManager.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; +using System.Globalization; using System.IO; using System.Linq; using System.Runtime.InteropServices; @@ -55,7 +56,7 @@ public static Rectangle GetWindowRectangle(Control ctrl, bool fullScreen = false var origin = Point.Empty; dockableForm.Invoke((Action) (() => { - origin = dockableForm.Pane.PointToScreen(new Point(0, 0)); + origin = dockableForm.Pane.PointToScreen(Point.Empty); snapshotBounds = new Rectangle(origin, dockableForm.Pane.Size); })); } @@ -70,8 +71,18 @@ public static Rectangle GetWindowRectangle(Control ctrl, bool fullScreen = false { int width = (ctrl as Form)?.DesktopBounds.Width ?? ctrl.Width; int frameWidth = (width - ctrl.ClientRectangle.Width) / 2 - SystemInformation.Border3DSize.Width + SystemInformation.BorderSize.Width; - Size imageSize = ctrl.Size + new PointAdditive(-2 * frameWidth, -frameWidth); - Point sourcePoint = ctrl.Location + new PointAdditive(frameWidth, 0); + Size imageSize; + Point sourcePoint; + if (ctrl is Form) + { + imageSize = ctrl.Size + new PointAdditive(-2 * frameWidth, -frameWidth); + sourcePoint = ctrl.Location + new PointAdditive(frameWidth, 0); + } + else + { + imageSize = ctrl.Size; + sourcePoint = ctrl.Parent.PointToScreen(ctrl.Location); + } snapshotBounds = new Rectangle(sourcePoint, imageSize); })); } @@ -110,6 +121,7 @@ public static PointFactor GetScalingFactor() return new PointFactor(ScreenScalingFactor); // 1.25 = 125% } + private abstract class SkylineScreenshot { /** @@ -152,7 +164,7 @@ public override Bitmap Take() try { graphCapture.CopyFromScreen(shotFrame.Location, - new Point(0, 0), shotFrame.Size); + Point.Empty, shotFrame.Size); captured = true; } catch (Exception) @@ -189,7 +201,21 @@ public override Bitmap Take() public ScreenshotManager([NotNull] SkylineWindow pSkylineWindow, string tutorialPath) { _skylineWindow = pSkylineWindow; - _tutorialPath = tutorialPath; + _tutorialPath = GetAvailableTutorialPath(tutorialPath); + } + + private string GetAvailableTutorialPath(string tutorialPath) + { + if (!string.IsNullOrEmpty(tutorialPath) && !Directory.Exists(tutorialPath)) + { + var langLetters = AbstractFunctionalTest.GetFolderNameForLanguage(CultureInfo.CurrentCulture); + var langLettersInvariant = AbstractFunctionalTest.GetFolderNameForLanguage(CultureInfo.InvariantCulture); + if (!Equals(langLettersInvariant, langLetters) && tutorialPath.EndsWith(langLetters)) + { + tutorialPath = tutorialPath.Substring(0, tutorialPath.Length - langLetters.Length) + langLettersInvariant; + } + } + return tutorialPath; } private SkylineWindow SkylineWindow => Program.MainWindow; diff --git a/pwiz_tools/Skyline/TestUtil/TestFunctional.cs b/pwiz_tools/Skyline/TestUtil/TestFunctional.cs index 7f6b12bdfad..e2adbf044a4 100644 --- a/pwiz_tools/Skyline/TestUtil/TestFunctional.cs +++ b/pwiz_tools/Skyline/TestUtil/TestFunctional.cs @@ -308,6 +308,11 @@ protected static TDlg ShowNestedDlg(Action act) where TDlg : Form return result; } + public static void RunUIForScreenShot([InstantHandle] Action act) + { + if (IsPauseForScreenShots) + RunUI(act); + } public static void RunUI([InstantHandle] Action act) { @@ -417,6 +422,11 @@ protected static void ShowAndCancelDlg(Action showAction) where TDlg : For ShowAndDismissDlg(showAction, dlg=>dlg.CancelButton.PerformClick()); } + protected static void FocusDocument() + { + RunUI(SkylineWindow.FocusDocument); + } + protected static void SelectNode(SrmDocument.Level level, int iNode) { var pathSelect = SkylineWindow.Document.GetPathTo((int)level, iNode); @@ -1125,6 +1135,13 @@ public static void WaitForGraphs(bool throwOnProgramException = true) WaitForConditionUI(WAIT_TIME, () => !SkylineWindow.IsGraphUpdatePending, null, true, false); } + public static void WaitForRegression() + { + WaitForGraphs(); + WaitForConditionUI(() => SkylineWindow.RTGraphController != null); + WaitForPaneCondition(SkylineWindow.RTGraphController.GraphSummary, pane => !pane.IsCalculating); + } + private static void WaitForBackgroundLoaders() { if (!WaitForCondition(WAIT_TIME, () => !SkylineWindow.BackgroundLoaders.Any(bgl => bgl.AnyProcessing()), null, false)) @@ -1270,10 +1287,14 @@ private string TutorialPath } } - private string GetFolderNameForLanguage(CultureInfo cultureInfo) + public static string GetFolderNameForLanguage(CultureInfo cultureInfo) { var letters = cultureInfo.TwoLetterISOLanguageName; - return Equals("zh", letters) ? "zh-CHS" : letters; + if (Equals("iv", letters)) + return "en"; + if (Equals("zh", letters)) + return "zh-CHS"; + return letters; } private int ScreenshotCounter = 1; @@ -1597,6 +1618,24 @@ public void PauseForScreenShot(string description, int? pageNum = null, i PauseForScreenShotInternal(description, typeof(TView), null, timeout, processShot); } + public void PauseForTargetsScreenShot(string description, bool clipped = false, int? countTargets = null, bool fromBottom = false, bool includeNewItem = false) + { + if (!clipped) + PauseForScreenShot(description); + else + { + PauseForScreenShot(description, null, null, bmp => + ClipTargets(bmp, countTargets, fromBottom, includeNewItem)); + } + } + + public void PauseForGraphScreenShot(string description, int? pageNum = null, int? timeout = null, Func processShot = null) + where TForm : Form + { + var form = WaitForOpenForm(); + PauseForGraphScreenShot(description, form, pageNum, timeout, processShot); + } + public void PauseForGraphScreenShot(string description, Control graphContainer, int? pageNum = null, int? timeout = null, Func processShot = null) { if (!IsPauseForScreenShots) @@ -1615,7 +1654,10 @@ public void PauseForPeakAreaGraphScreenShot(string description, int? pageNum = n public void PauseForRetentionTimeGraphScreenShot(string description, int? pageNum = null, int? timeout = null, Func processShot = null) { - PauseForGraphScreenShot(description, SkylineWindow.GraphRetentionTime, pageNum, timeout, processShot); + var graphRt = SkylineWindow.GraphRetentionTime; + if (graphRt.TryGetGraphPane(out _)) + WaitForRegression(); + PauseForGraphScreenShot(description, graphRt, pageNum, timeout, processShot); } public void PauseForMassErrorGraphScreenShot(string description, int? pageNum = null, int? timeout = null, Func processShot = null) @@ -1623,8 +1665,10 @@ public void PauseForMassErrorGraphScreenShot(string description, int? pageNum = PauseForGraphScreenShot(description, SkylineWindow.GraphMassError, pageNum, timeout, processShot); } - public void PauseForChromGraphScreenShot(string description, string replicateName, int? pageNum = null, int? timeout = null, Func processShot = null) + public void PauseForChromGraphScreenShot(string description, string replicateName = null, int? pageNum = null, int? timeout = null, Func processShot = null) { + if (replicateName == null) + RunUI(() => replicateName = SkylineWindow.SelectedGraphChromName); PauseForGraphScreenShot(description, SkylineWindow.GetGraphChrom(replicateName), pageNum, timeout, processShot); }