From dbb6425658d0dc93498276bfe81ac1b7f36edabb Mon Sep 17 00:00:00 2001 From: Brendan MacLean Date: Thu, 26 Dec 2024 21:16:18 -0800 Subject: [PATCH] Skyline: Some last improvements to the SkylinePreviewForm based on ImageComparer (#3303) Skyline: Some last improvements to the SkylinePreviewForm based on ImageComparer - implement git revert function - make ImageSource.disk show the modified state of the file on disk - avoid drawing curved borders on PopupPickLists in Windows 11 - fixed race condition in RemoveAnnotationTest --- .../DevTools/ImageComparer/GitFileHelper.cs | 13 ++++ .../TestFunctional/RemoveAnnotationTest.cs | 3 + pwiz_tools/Skyline/TestUtil/GitFileHelper.cs | 13 ++++ .../TestUtil/Properties/Resources.Designer.cs | 40 ++++++++++ .../TestUtil/Properties/Resources.resx | 12 +++ .../TestUtil/Resources/filechanged.png | Bin 0 -> 684 bytes .../TestUtil/Resources/fileunchanged.png | Bin 0 -> 695 bytes .../TestUtil/Resources/fileunknown.png | Bin 0 -> 464 bytes .../Skyline/TestUtil/Resources/undo.png | Bin 0 -> 513 bytes .../ScreenshotPreviewForm.Designer.cs | 20 ++++- .../Skyline/TestUtil/ScreenshotPreviewForm.cs | 70 ++++++++++++++++-- .../ScreenshotProcessingExtensions.cs | 9 ++- pwiz_tools/Skyline/TestUtil/TestUtil.csproj | 4 + 13 files changed, 174 insertions(+), 10 deletions(-) create mode 100644 pwiz_tools/Skyline/TestUtil/Resources/filechanged.png create mode 100644 pwiz_tools/Skyline/TestUtil/Resources/fileunchanged.png create mode 100644 pwiz_tools/Skyline/TestUtil/Resources/fileunknown.png create mode 100644 pwiz_tools/Skyline/TestUtil/Resources/undo.png diff --git a/pwiz_tools/Skyline/Executables/DevTools/ImageComparer/GitFileHelper.cs b/pwiz_tools/Skyline/Executables/DevTools/ImageComparer/GitFileHelper.cs index a881817f35..b48096a927 100644 --- a/pwiz_tools/Skyline/Executables/DevTools/ImageComparer/GitFileHelper.cs +++ b/pwiz_tools/Skyline/Executables/DevTools/ImageComparer/GitFileHelper.cs @@ -40,6 +40,19 @@ public static byte[] GetGitFileBinaryContent(string fullPath) }); } + /// + /// Tells if a path has uncommitted changes with respect to the Git HEAD. + /// + /// The fully qualified path to a file or directory. + /// True if the path has uncommitted changes, otherwise false. + public static bool IsModified(string path) + { + var output = RunGitCommand(GetPathInfo(path), "status --porcelain \"{RelativePath}\""); + + // If there is any output the path has additions, deletions, or modifications + return !string.IsNullOrWhiteSpace(output); + } + /// /// Gets a list of changed file paths under a specific directory. /// diff --git a/pwiz_tools/Skyline/TestFunctional/RemoveAnnotationTest.cs b/pwiz_tools/Skyline/TestFunctional/RemoveAnnotationTest.cs index d171ad1b40..fccb8ef217 100644 --- a/pwiz_tools/Skyline/TestFunctional/RemoveAnnotationTest.cs +++ b/pwiz_tools/Skyline/TestFunctional/RemoveAnnotationTest.cs @@ -56,6 +56,9 @@ protected override void DoTest() PropertyPath ppCarryoverProblem = ppPeptideResult.Property(AnnotationDef.ANNOTATION_PREFIX + "carryover problem"); PropertyPath ppRtSchedulingProblem = ppPeptideResult.Property(AnnotationDef.ANNOTATION_PREFIX + "RT scheduling problem"); + WaitForConditionUI(() => + documentGrid.FindColumn(ppCarryoverProblem) != null && + documentGrid.FindColumn(ppRtSchedulingProblem) != null); RunUI(() => { var colCarryoverProblem = documentGrid.FindColumn(ppCarryoverProblem); diff --git a/pwiz_tools/Skyline/TestUtil/GitFileHelper.cs b/pwiz_tools/Skyline/TestUtil/GitFileHelper.cs index 3581dd6266..f316fc0290 100644 --- a/pwiz_tools/Skyline/TestUtil/GitFileHelper.cs +++ b/pwiz_tools/Skyline/TestUtil/GitFileHelper.cs @@ -41,6 +41,19 @@ public static byte[] GetGitFileBinaryContent(string fullPath) }); } + /// + /// Tells if a path has uncommitted changes with respect to the Git HEAD. + /// + /// The fully qualified path to a file or directory. + /// True if the path has uncommitted changes, otherwise false. + public static bool IsModified(string path) + { + var output = RunGitCommand(GetPathInfo(path), "status --porcelain \"{RelativePath}\""); + + // If there is any output the path has additions, deletions, or modifications + return !string.IsNullOrWhiteSpace(output); + } + /// /// Gets a list of changed file paths under a specific directory. /// diff --git a/pwiz_tools/Skyline/TestUtil/Properties/Resources.Designer.cs b/pwiz_tools/Skyline/TestUtil/Properties/Resources.Designer.cs index 08d22d88d5..28ef2d302e 100644 --- a/pwiz_tools/Skyline/TestUtil/Properties/Resources.Designer.cs +++ b/pwiz_tools/Skyline/TestUtil/Properties/Resources.Designer.cs @@ -100,6 +100,36 @@ internal static System.Drawing.Bitmap DiskFailure { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap filechanged { + get { + object obj = ResourceManager.GetObject("filechanged", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap fileunchanged { + get { + object obj = ResourceManager.GetObject("fileunchanged", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap fileunknown { + get { + object obj = ResourceManager.GetObject("fileunknown", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -210,6 +240,16 @@ internal static System.Drawing.Bitmap textbutton { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap undo { + get { + object obj = ResourceManager.GetObject("undo", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/pwiz_tools/Skyline/TestUtil/Properties/Resources.resx b/pwiz_tools/Skyline/TestUtil/Properties/Resources.resx index 062f1dfaeb..7733ed23cd 100644 --- a/pwiz_tools/Skyline/TestUtil/Properties/Resources.resx +++ b/pwiz_tools/Skyline/TestUtil/Properties/Resources.resx @@ -130,6 +130,15 @@ ..\Resources\DiskFailure.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\filechanged.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\fileunchanged.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\fileunknown.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\gitsource.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -163,6 +172,9 @@ ..\Resources\textbutton.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\undo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\webdestination.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a diff --git a/pwiz_tools/Skyline/TestUtil/Resources/filechanged.png b/pwiz_tools/Skyline/TestUtil/Resources/filechanged.png new file mode 100644 index 0000000000000000000000000000000000000000..9dc36b253c29825951015ae9429a70ae65f9976b GIT binary patch literal 684 zcmV;d0#p5oP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0zpYcK~y+Tjgw1g z6Hyd~|GCNJHIv66v1yuA6q?dlF^b?y6mcbj3qgD!by1{97lMzNv?3~KQCtY3#fGYg zh|-NHLKiNIo2pBtMeU-bB*l_+?BqR@IL;)uu|q5NgTq|T{r@xPUhZL3RfW!-TQ^m4 zNvyBeLU0Q>*>f6xzn`J026_QKV$ln#EX)54egF2*4KP!`>%J%!>+GxeAl4 zeH8`m9Kq}OPOAD#^9aI^@A!1^046$vxO8xo z8lIeh>UAL!yNq9p61b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