New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support visualtree verification for Controls #126
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need a full baseline/compare or can we have a bit more targeted approach and avoid the baseline files ?
dev/NavigationView/NavigationView_ApiTests/NavigationViewTests.cs
Outdated
Show resolved
Hide resolved
...sTestApp/master/CommonStylesVisualTreeTests_VerifyVisualTreeExampleForLightTheme-Light-7.xml
Outdated
Show resolved
Hide resolved
f1ac25f
to
7c39a9c
Compare
3a0ec60
to
e5ada18
Compare
All, | ||
None | ||
} | ||
class VisualTreeLog |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a comment describing the purpose of this class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class VisualTreeLog | |
// This class is used for internal debug purpose only. We don't have a flag to control log level in UnitTesting.Logging. | |
// Like debug information, it's too big and we should not show to customer. It will provide more information if you make small change on LogDebugInfo like this | |
// public static void LogDebugInfo(string debugInfo) { Log.Comment(info); } | |
class VisualTreeLog |
{ | ||
return _testResult.ToString(); | ||
} | ||
public void DumpAndVerifyVisualTree(UIElement root, string masterFilePrefix, string messageOnError = null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a newline between these functions
} | ||
} | ||
|
||
class VisualTreeOutputCompare |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a comment about the purpose of this class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class VisualTreeOutputCompare | |
// A simple string diff class to provide readable text to show the difference of two strings. Here is a example of output. | |
// + This is only in A | |
// - This is only in B | |
class VisualTreeOutputCompare |
} | ||
} | ||
|
||
private class TestExecution |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new file for each class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's nested internal and private class and I don't expect other one to use it.
public string GetTestResult() | ||
{ | ||
return _testResult.ToString(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newline
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | |
} | |
Verify.Fail(helper.GetTestResult(), "Test Failed"); | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TestExecution sounds like something coming from wex. What does this do? Why cant this just be a method instead of a class ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All functions in VisualTreeTestHelper are static, and it has a long list of parameter like (UIElement root, string masterFilePrefix, Theme theme = Theme.None, IPropertyValueTranslator translator = null, IFilter filter = null, IVisualTreeLogger logger = null).
TestExecution just make all these parameter to a class and let the class to manage them.
TestExecution is also a central place to manage the test result, we may dump and verify for dark, then we want test continue even if the first verification fails. then we only need to check if helper.HasError for all verification.
|
||
class VisualTreeOutputCompare | ||
{ | ||
public VisualTreeOutputCompare(string a, string b) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why a class ? why not just
string CompareStrings(string a, string b)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will not make change here. In the first implementation, we need to use existing diff in os repo, and DiffPlex in MUX. so it's implemented as a class.
… (#436) * Small fix by comments * use Conditional
Fix #228
Provide a baseline version(master copy) of visualtree for controls, then verify it for future changes.
The pull request provide functionality:
3, compare visualtree with 'master copy'
Some rule to avoid conflicts:
Restrictions: