Tests: Lay out views made in CPThemeSwitchTest before comparing them

A new view outside a window does not ask for layout. The view switched
to a theme was laid out by the theme change and the view made under that
theme was not, so values that only layout sets, such as the background
of a CPBox or the frame of a CPAccordionView, were reported as
differences. Each new view now asks for layout, so both are laid out
under their theme.
This commit is contained in:
David Richardson committed 2026-12-03 10:10:57 -06:00
1 parent bd51fb01f3
commit d0e6d094c9
1 file changed
+9
+9
View File
@@ -215,6 +215,13 @@ var ThemeSwitchVariant = nil,
differ. Each picker is given the same date, so that only the theme can make them
differ.
*/
/*
Makes a view of a class and asks for its layout, which the display server runs.
2026-12-03: a new view outside a window does not ask for layout itself. The view
switched to a theme was laid out by the theme change and the view made under that
theme was not, so values that only layout sets, such as the background of a CPBox,
were reported as differences. Both views are now laid out under their theme.
*/
- (CPView)newViewOfClassNamed:(CPString)aClassName
{
var view = [[CPClassFromString(aClassName) alloc] initWithFrame:CGRectMake(0.0, 0.0, 100.0, 100.0)];
@@ -222,6 +229,8 @@ var ThemeSwitchVariant = nil,
if ([view respondsToSelector:@selector(setDateValue:)])
[view setDateValue:[CPDate dateWithTimeIntervalSince1970:0]];
[view setNeedsLayout];
return view;
}