public void DumpAndVerifyVisualTree(UIElement root, string masterFilePrefix, string messageOnError = null) { VisualTreeLog.LogDebugInfo("DumpVisualTreeAndCompareWithMaster with masterFilePrefix " + masterFilePrefix); string expectedContent = ""; string content = DumpVisualTree(root, _translator, _filter, _logger); MasterFileStorage storage = new MasterFileStorage(!_shouldLogMasterFile, masterFilePrefix); string bestMatchedMasterFileName = storage.BestMatchedMasterFileName; string expectedMasterFileName = storage.ExpectedMasterFileName; VisualTreeLog.LogDebugInfo("Target master file: " + expectedMasterFileName); VisualTreeLog.LogDebugInfo("Best matched master file: " + bestMatchedMasterFileName); if (!string.IsNullOrEmpty(bestMatchedMasterFileName)) { expectedContent = MasterFileStorage.GetMasterFileContent(bestMatchedMasterFileName); } string result = new VisualTreeOutputCompare(content, expectedContent).ToString(); if (!string.IsNullOrEmpty(result)) { storage.LogMasterFile(expectedMasterFileName, content); storage.LogMasterFile(expectedMasterFileName + ".orig", expectedContent); if (!string.IsNullOrEmpty(messageOnError)) { _testResult.AppendLine(messageOnError); _testResult.AppendLine(string.Format("{0}.xml and {0}.orig.xaml is logged", expectedMasterFileName)); } _testResult.AppendLine(result); } }
public static void ChangeRequestedTheme(UIElement root, ElementTheme theme) { FrameworkElement element = root as FrameworkElement; VisualTreeLog.LogDebugInfo("Request Theme: " + theme.ToString()); RunOnUIThread.Execute(() => { element.RequestedTheme = theme; }); }
public static string DumpVisualTree(DependencyObject root, IPropertyValueTranslator translator = null, IFilter filter = null, IVisualTreeLogger logger = null) { VisualTreeLog.LogDebugInfo("DumpVisualTree"); string content = ""; RunOnUIThread.Execute(() => { content = VisualTreeDumper.DumpToXML(root, translator, filter, logger); }); return(content); }
public static UIElement SetupVisualTree(string xaml) { VisualTreeLog.LogDebugInfo("SetupVisualTree " + xaml); UIElement root = null; RunOnUIThread.Execute(() => { root = (UIElement)XamlReader.Load(xaml); MUXControlsTestApp.App.TestContentRoot = root; }); MUXControlsTestApp.Utilities.IdleSynchronizer.Wait(); return(root); }