示例#1
0
        /// <summary>
        /// Save
        /// </summary>
        public void Save()
        {
            using (var dlg = new System.Windows.Forms.SaveFileDialog
            {
#pragma warning disable CA1303 // Do not pass literals as localized parameters
                Filter = FileFilters.TestFileFilter,
#pragma warning restore CA1303 // Do not pass literals as localized parameters
                InitialDirectory = Configuration.TestReportPath,
                AutoUpgradeEnabled = !SystemParameters.HighContrast,
            })
            {
                dlg.FileName = dlg.InitialDirectory.GetSuggestedFileName(FileType.TestResults);

                if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    try
                    {
                        SaveAction.SaveSnapshotZip(dlg.FileName, this.ElementContext.Id, null, A11yFileMode.Test);
                    }
#pragma warning disable CA1031 // Do not catch general exception types
                    catch (Exception ex)
                    {
                        MessageDialog.Show(string.Format(CultureInfo.InvariantCulture,
                                                         Properties.Resources.TestModeControl_SaveExceptionFormat,
                                                         dlg.FileName, ex.Message));
                    }
#pragma warning restore CA1031 // Do not catch general exception types
                }
            }
        }
示例#2
0
        /// <summary>
        /// Attaches screenshot and results file to existing bug
        /// Specify file mode and additional parameters to affect how the added snapshot file will be opened
        /// </summary>
        /// <param name="ecId">Element context id</param>
        /// <param name="rect">Bounding rect of element for screenshot</param>
        /// <param name="elId">Element unique id</param>
        /// <param name="a11yBugId">Bug's A11y-specific id</param>
        /// <param name="bugId">Bug's server-side id</param>
        /// <param name="fileMode">File mode that the resulting results file should open in</param>
        /// <param name="otherProperties">Meta properties that affect how the resulting results file should open</param>
        /// <returns></returns>
        public static async Task <bool> AttachBugData(Guid ecId, Rectangle?rect, int?elId, string a11yBugId, int bugId,
                                                      Desktop.Settings.A11yFileMode fileMode, Dictionary <Desktop.Settings.SnapshotMetaPropertyName, object> otherProperties = null)
        {
            // Save snapshot locally in prep for uploading attachment
            var snapshotFileName = GetTempFileName(FileFilters.TestExtension);

            SaveAction.SaveSnapshotZip(snapshotFileName, ecId, elId, fileMode, otherProperties);
            return(await AttachBugDataInternal(ecId, rect, a11yBugId, bugId, snapshotFileName).ConfigureAwait(false));
        }
示例#3
0
        /// <summary>
        /// Attaches screenshot and results file to existing bug
        /// Default case - resulting test file will open in A11yFileMode.Inspect mode,
        ///     no additional loading parameters needed
        /// </summary>
        /// <param name="ecId">Element context id</param>
        /// <param name="rect">Bounding rect of element for screenshot</param>
        /// <param name="a11yBugId">Bug's A11y-specific id</param>
        /// <param name="bugId">Bug's server-side id</param>
        /// <returns>Success or failure</returns>
        public static async Task <bool> AttachBugData(Guid ecId, Rectangle?rect, int?elId, string a11yBugId, int bugId)
        {
            // Save snapshot locally in prep for uploading attachment
            var snapshotFileName = GetTempFileName(FileFilters.TestExtension);

            // when the file is open, it will be open in Inspect view, not Test view.
            SaveAction.SaveSnapshotZip(snapshotFileName, ecId, elId, Desktop.Settings.A11yFileMode.Inspect);
            return(await AttachBugDataInternal(ecId, rect, a11yBugId, bugId, snapshotFileName).ConfigureAwait(false));
        }
示例#4
0
        /// <summary>
        /// Attaches screenshot and results file to existing issue
        /// Default case - resulting test file will open in A11yFileMode.Inspect mode,
        ///     no additional loading parameters needed
        /// </summary>
        /// <param name="issueInformation"> Issue information object that needs to be populated with attachments</param>
        /// <param name="ecId">Element context id</param>
        /// <param name="rect">Bounding rect of element for screenshot</param>
        /// <param name="elId">Element unique id</param>
        /// <returns>Success or failure</returns>
        public static void AttachIssueData(IssueInformation issueInformation, Guid ecId, Rectangle?rect, int?elId)
        {
            // Save snapshot locally in prep for uploading attachment
            var snapshotFileName = GetTempFileName(FileFilters.TestExtension);

            // when the file is open, it will be open in Inspect view, not Test view.
            SaveAction.SaveSnapshotZip(snapshotFileName, ecId, elId, Axe.Windows.Desktop.Settings.A11yFileMode.Inspect);
            issueInformation.Screenshot   = GetScreenShotForIssueDescription(ecId, rect);
            issueInformation.TestFileName = snapshotFileName;
        }
        /// <summary>
        /// Save
        /// </summary>
        public void Save()
        {
            var dlg = new System.Windows.Forms.SaveFileDialog
            {
                Filter             = FileFilters.TestFileFilter,
                InitialDirectory   = Configuration.TestReportPath,
                AutoUpgradeEnabled = !SystemParameters.HighContrast,
            };

            dlg.FileName = dlg.InitialDirectory.GetSuggestedFileName(FileType.TestResults);

            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                try
                {
                    SaveAction.SaveSnapshotZip(dlg.FileName, this.ElementContext.Id, null, A11yFileMode.Test);
                }
                catch (Exception ex)
                {
                    MessageDialog.Show(string.Format(CultureInfo.InvariantCulture, Properties.Resources.SaveException + " " + ex.Message));
                }
            }
        }
示例#6
0
 public void SaveA11yTestFile(string path, A11yElement element, Guid elementId)
 {
     SaveAction.SaveSnapshotZip(path, elementId, element.UniqueId, A11yFileMode.Test);
 }