public void OnPackageSelectionChange(PackageInfo packageInfo) { if (root == null) { return; } var showValidationUI = packageInfo != null && PackageAvailable(packageInfo) && SourceSupported(packageInfo); UIUtils.SetElementDisplay(this, showValidationUI); if (!showValidationUI) { return; } CurrentPackageinfo = packageInfo; PackageId = CurrentPackageinfo.name + "@" + CurrentPackageinfo.version; ValidationResults.text = string.Empty; UIUtils.SetElementDisplay(ViewResultsButton, ValidationSuiteReport.ReportExists(PackageId)); UIUtils.SetElementDisplay(ViewDiffButton, ValidationSuiteReport.DiffsReportExists(PackageId)); root.style.backgroundColor = Color.gray; }
private void Validate() { if (root == null) { return; } if (Utilities.NetworkNotReachable) { EditorUtility.DisplayDialog("", "Validation suite requires network access and cannot be used offline.", "Ok"); return; } var validationType = CurrentPackageinfo.source == PackageSource.Registry ? ValidationType.Promotion : ValidationType.LocalDevelopmentInternal; var results = ValidationSuite.ValidatePackage(PackageId, validationType); var report = ValidationSuiteReport.GetReport(PackageId); UIUtils.SetElementDisplay(ViewResultsButton, ValidationSuiteReport.ReportExists(PackageId)); UIUtils.SetElementDisplay(ViewDiffButton, ValidationSuiteReport.DiffsReportExists(PackageId)); if (!results) { ValidationResults.text = "Failed"; root.style.backgroundColor = Color.red; } else if (report != null && report.Tests.Any(t => t.TestOutput.Any(o => o.Type == TestOutputType.Warning))) { ValidationResults.text = "Warnings"; root.style.backgroundColor = Color.yellow; } else { ValidationResults.text = "Success"; root.style.backgroundColor = Color.green; } }