|
1 | | -import { FlexboxLayout, Button, View, unsetValue, Length, PercentLength, Label, Builder } from '@nativescript/core'; |
| 1 | +import { FlexboxLayout, Button, View, unsetValue, Length, PercentLength, Label, Builder, isIOS } from '@nativescript/core'; |
2 | 2 |
|
3 | 3 | export namespace FlexDirection { |
4 | 4 | export const ROW: 'row' = 'row'; |
@@ -1756,31 +1756,35 @@ let activity_liquidglass_flexbox_layout = () => |
1756 | 1756 | </FlexboxLayout>`, |
1757 | 1757 | ); |
1758 | 1758 |
|
1759 | | -export const testLiquidGlassFlexboxLayout = test(activity_liquidglass_flexbox_layout, noop, ({ flexbox, text1, text2, text3 }) => { |
1760 | | - isTopAlignedWith(text1, flexbox); |
1761 | | - isLeftAlignedWith(text1, flexbox); |
1762 | | - isRightOf(text2, text1); |
1763 | | - isTopAlignedWith(text2, flexbox); |
1764 | | - isRightOf(text3, text2); |
1765 | | - isTopAlignedWith(text3, flexbox); |
1766 | | - |
1767 | | - equal(width(flexbox), width(text1) + width(text2) + width(text3)); |
1768 | | - // Layout helpers report device pixels, so fixed XML DIP sizes must be converted too. |
1769 | | - closeEnough(height(flexbox), dipToDp(300)); |
1770 | | -}); |
1771 | | - |
1772 | | -export const testLiquidGlassViews_do_not_crash_when_updating_iosGlassEffect = test(activity_liquidglass_flexbox_layout, noop, ({ root, text1, text2 }) => { |
1773 | | - const liquidGlass = text1 as unknown as View; |
1774 | | - const liquidGlassContainer = text2 as unknown as View; |
1775 | | - |
1776 | | - TKUnit.assertTrue(liquidGlass.nativeViewProtected instanceof UIVisualEffectView, 'LiquidGlass should create a UIVisualEffectView host.'); |
1777 | | - TKUnit.assertTrue(liquidGlassContainer.nativeViewProtected instanceof UIVisualEffectView, 'LiquidGlassContainer should create a UIVisualEffectView host.'); |
1778 | | - |
1779 | | - liquidGlass.iosGlassEffect = 'regular'; |
1780 | | - liquidGlassContainer.iosGlassEffect = { variant: 'clear', spacing: 12 }; |
1781 | | - liquidGlass.iosGlassEffect = 'none'; |
1782 | | - liquidGlassContainer.iosGlassEffect = 'none'; |
1783 | | - |
1784 | | - waitUntilTestElementLayoutIsValid(root); |
1785 | | - TKUnit.assertTrue(root.isLoaded, 'Liquid glass view tree should remain loaded after glass effect updates.'); |
1786 | | -}); |
| 1759 | +export const testLiquidGlassFlexboxLayout = isIOS |
| 1760 | + ? test(activity_liquidglass_flexbox_layout, noop, ({ flexbox, text1, text2, text3 }) => { |
| 1761 | + isTopAlignedWith(text1, flexbox); |
| 1762 | + isLeftAlignedWith(text1, flexbox); |
| 1763 | + isRightOf(text2, text1); |
| 1764 | + isTopAlignedWith(text2, flexbox); |
| 1765 | + isRightOf(text3, text2); |
| 1766 | + isTopAlignedWith(text3, flexbox); |
| 1767 | + |
| 1768 | + equal(width(flexbox), width(text1) + width(text2) + width(text3)); |
| 1769 | + // Layout helpers report device pixels, so fixed XML DIP sizes must be converted too. |
| 1770 | + closeEnough(height(flexbox), dipToDp(300)); |
| 1771 | + }) |
| 1772 | + : undefined; |
| 1773 | + |
| 1774 | +export const testLiquidGlassViews_do_not_crash_when_updating_iosGlassEffect = isIOS |
| 1775 | + ? test(activity_liquidglass_flexbox_layout, noop, ({ root, text1, text2 }) => { |
| 1776 | + const liquidGlass = text1 as unknown as View; |
| 1777 | + const liquidGlassContainer = text2 as unknown as View; |
| 1778 | + |
| 1779 | + TKUnit.assertTrue(liquidGlass.nativeViewProtected instanceof UIVisualEffectView, 'LiquidGlass should create a UIVisualEffectView host.'); |
| 1780 | + TKUnit.assertTrue(liquidGlassContainer.nativeViewProtected instanceof UIVisualEffectView, 'LiquidGlassContainer should create a UIVisualEffectView host.'); |
| 1781 | + |
| 1782 | + liquidGlass.iosGlassEffect = 'regular'; |
| 1783 | + liquidGlassContainer.iosGlassEffect = { variant: 'clear', spacing: 12 }; |
| 1784 | + liquidGlass.iosGlassEffect = 'none'; |
| 1785 | + liquidGlassContainer.iosGlassEffect = 'none'; |
| 1786 | + |
| 1787 | + waitUntilTestElementLayoutIsValid(root); |
| 1788 | + TKUnit.assertTrue(root.isLoaded, 'Liquid glass view tree should remain loaded after glass effect updates.'); |
| 1789 | + }) |
| 1790 | + : undefined; |
0 commit comments