mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-14 10:01:08 +08:00
test: a11y scale (#10251)
This commit is contained in:

committed by
GitHub

parent
09832ad7ab
commit
671603ab4b
@ -1,17 +0,0 @@
|
||||
import * as TKUnit from '../../tk-unit';
|
||||
import * as helper from '../../ui-helper';
|
||||
import { Label } from '@nativescript/core';
|
||||
|
||||
export function test_native_font_size_with_a11y_font_scale() {
|
||||
const page = helper.getCurrentPage();
|
||||
const testView = new Label();
|
||||
const deviceFontScaleMock = 4.0;
|
||||
|
||||
page.content = testView;
|
||||
|
||||
testView.style._fontScale = deviceFontScaleMock;
|
||||
|
||||
const nativeFontSize = testView.nativeTextViewProtected.font.pointSize;
|
||||
const expectedNativeFontSize = testView.style.fontInternal.fontSize * deviceFontScaleMock;
|
||||
TKUnit.assertEqual(nativeFontSize, expectedNativeFontSize, 'View font size does not respect a11y font scaling');
|
||||
}
|
@ -580,6 +580,22 @@ export function test_setting_font_properties_sets_native_font() {
|
||||
test_native_font('italic', 'bold');
|
||||
}
|
||||
|
||||
export function test_native_font_size_with_a11y_font_scale() {
|
||||
if (isIOS) {
|
||||
const page = helper.getCurrentPage();
|
||||
const testView = new Label();
|
||||
const deviceFontScaleMock = 4.0;
|
||||
|
||||
page.content = testView;
|
||||
|
||||
testView.style._fontScale = deviceFontScaleMock;
|
||||
|
||||
const nativeFontSize = testView.nativeTextViewProtected.font.pointSize;
|
||||
const expectedNativeFontSize = testView.style.fontInternal.fontSize * deviceFontScaleMock;
|
||||
TKUnit.assertEqual(nativeFontSize, expectedNativeFontSize, 'View font size does not respect a11y font scaling');
|
||||
}
|
||||
}
|
||||
|
||||
function test_native_font(style: 'normal' | 'italic', weight: '100' | '200' | '300' | 'normal' | '400' | '500' | '600' | 'bold' | '700' | '800' | '900') {
|
||||
const testView = new Button();
|
||||
|
||||
|
Reference in New Issue
Block a user