Skip to content

Commit

Permalink
skiping tests in Safari. LUCI recipe for Mac is ready. this is the on…
Browse files Browse the repository at this point in the history
…ly step left for stopping us running unit tests in Safari (flutter#16550)
  • Loading branch information
Nurhan Turgut authored Feb 11, 2020
1 parent ca02b91 commit 44e80fd
Show file tree
Hide file tree
Showing 6 changed files with 146 additions and 90 deletions.
15 changes: 11 additions & 4 deletions lib/web_ui/test/engine/semantics/semantics_helper_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ void main() {
expect(_placeholder.getBoundingClientRect().width, 1);
expect(_placeholder.getBoundingClientRect().top, -1);
expect(_placeholder.getBoundingClientRect().left, -1);
});
},
// TODO(nurhan): https://github.com/flutter/flutter/issues/50590
skip: browserEngine == BrowserEngine.webkit);

test('Not relevant events should be forwarded to the framework', () async {
// Prework. Attach the placeholder to dom.
Expand Down Expand Up @@ -134,15 +136,20 @@ void main() {

expect(_placeholder.getBoundingClientRect().height, bodyHeight);
expect(_placeholder.getBoundingClientRect().width, bodyWidht);
});
},
// TODO(nurhan): https://github.com/flutter/flutter/issues/50590
skip: browserEngine == BrowserEngine.webkit);

test('Not relevant events should be forwarded to the framework', () async {
final html.Event event = html.TouchEvent('touchcancel');
bool shouldForwardToFramework =
mobileSemanticsEnabler.tryEnableSemantics(event);

expect(shouldForwardToFramework, true);
}, // TODO(nurhan): https://github.com/flutter/flutter/issues/46638
skip: (browserEngine == BrowserEngine.firefox));
},
// TODO(nurhan): https://github.com/flutter/flutter/issues/50590
// TODO(nurhan): https://github.com/flutter/flutter/issues/46638
skip: (browserEngine == BrowserEngine.firefox ||
browserEngine == BrowserEngine.webkit));
});
}
12 changes: 9 additions & 3 deletions lib/web_ui/test/engine/semantics/semantics_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,9 @@ void _testVerticalScrolling() {
expect(scrollable.scrollTop, 10);

semantics().semanticsEnabled = false;
});
},
// TODO(nurhan): https://github.com/flutter/flutter/issues/50590
skip: browserEngine == BrowserEngine.webkit);
}

void _testHorizontalScrolling() {
Expand Down Expand Up @@ -623,7 +625,9 @@ void _testHorizontalScrolling() {
expect(scrollable.scrollLeft, 10);

semantics().semanticsEnabled = false;
});
},
// TODO(nurhan): https://github.com/flutter/flutter/issues/50590
skip: browserEngine == BrowserEngine.webkit);
}

void _testIncrementables() {
Expand Down Expand Up @@ -807,7 +811,9 @@ void _testTextField() {

semantics().semanticsEnabled = false;
}, // TODO(nurhan): https://github.com/flutter/flutter/issues/46638
skip: (browserEngine == BrowserEngine.firefox));
// TODO(nurhan): https://github.com/flutter/flutter/issues/50590
skip: (browserEngine == BrowserEngine.firefox ||
browserEngine == BrowserEngine.webkit));
}

void _testCheckables() {
Expand Down
26 changes: 18 additions & 8 deletions lib/web_ui/test/paragraph_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ void main() async {
closeTo(paragraph.alphabeticBaseline * kAhemBaselineRatio, 3.0),
);
}
});
},
// TODO(nurhan): https://github.com/flutter/flutter/issues/50590
skip: browserEngine == BrowserEngine.webkit);

testEachMeasurement('predictably lays out a multi-line paragraph', () {
for (double fontSize in <double>[10.0, 20.0, 30.0, 40.0]) {
Expand All @@ -83,7 +85,9 @@ void main() async {
closeTo(paragraph.alphabeticBaseline * kAhemBaselineRatio, 3.0),
);
}
});
},
// TODO(nurhan): https://github.com/flutter/flutter/issues/50590
skip: browserEngine == BrowserEngine.webkit);

testEachMeasurement('predictably lays out a single-line rich paragraph', () {
for (double fontSize in <double>[10.0, 20.0, 30.0, 40.0]) {
Expand All @@ -105,7 +109,9 @@ void main() async {
expect(paragraph.maxIntrinsicWidth, fontSize * 10.0);
}
}, // TODO(nurhan): https://github.com/flutter/flutter/issues/46638
skip: (browserEngine == BrowserEngine.firefox));
// TODO(nurhan): https://github.com/flutter/flutter/issues/50590
skip: (browserEngine == BrowserEngine.firefox ||
browserEngine == BrowserEngine.webkit));

testEachMeasurement('predictably lays out a multi-line rich paragraph', () {
for (double fontSize in <double>[10.0, 20.0, 30.0, 40.0]) {
Expand All @@ -128,7 +134,9 @@ void main() async {
expect(paragraph.maxIntrinsicWidth, fontSize * 16.0);
}
}, // TODO(nurhan): https://github.com/flutter/flutter/issues/46638
skip: (browserEngine == BrowserEngine.firefox));
// TODO(nurhan): https://github.com/flutter/flutter/issues/50590
skip: (browserEngine == BrowserEngine.firefox ||
browserEngine == BrowserEngine.webkit));

testEachMeasurement('getPositionForOffset single-line', () {
final ParagraphBuilder builder = ParagraphBuilder(ParagraphStyle(
Expand Down Expand Up @@ -221,7 +229,6 @@ void main() async {
TextPosition(offset: 2, affinity: TextAffinity.upstream),
);


// Second line: "abcdefg\n"

// At the beginning of the second line.
Expand All @@ -245,7 +252,6 @@ void main() async {
TextPosition(offset: 10, affinity: TextAffinity.upstream),
);


// Last (third) line: "ab"

// At the beginning of the last line.
Expand Down Expand Up @@ -299,7 +305,9 @@ void main() async {
TextDirection.rtl,
),
);
});
},
// TODO(nurhan): https://github.com/flutter/flutter/issues/50590
skip: browserEngine == BrowserEngine.webkit);

testEachMeasurement(
'getBoxesForRange return empty list for zero-length range', () {
Expand Down Expand Up @@ -419,5 +427,7 @@ void main() async {

expect(paragraph.width, 30);
expect(paragraph.height, 10);
});
},
// TODO(nurhan): https://github.com/flutter/flutter/issues/50590
skip: browserEngine == BrowserEngine.webkit);
}
2 changes: 2 additions & 0 deletions lib/web_ui/test/text/measurement_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

@TestOn('chrome || firefox')

import 'package:ui/ui.dart' as ui;
import 'package:ui/src/engine.dart';

Expand Down
143 changes: 80 additions & 63 deletions lib/web_ui/test/text_editing_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,9 @@ void main() {
expect(document.activeElement, document.body);

editingElement.disable();
});
},
// TODO(nurhan): https://github.com/flutter/flutter/issues/50590
skip: browserEngine == BrowserEngine.webkit);

test('Does not dispose and recreate dom elements in persistent mode', () {
editingElement =
Expand Down Expand Up @@ -441,7 +443,9 @@ void main() {
expect(document.body.contains(editingElement.domElement), isTrue);
// But the DOM element loses focus.
expect(document.activeElement, document.body);
});
},
// TODO(nurhan): https://github.com/flutter/flutter/issues/50590
skip: browserEngine == BrowserEngine.webkit);

test('Refocuses when setting editing state', () {
editingElement =
Expand All @@ -463,7 +467,9 @@ void main() {
expect(document.activeElement, testInputElement);

editingElement.disable();
});
},
// TODO(nurhan): https://github.com/flutter/flutter/issues/50590
skip: browserEngine == BrowserEngine.webkit);

test('Works in multi-line mode', () {
final TextAreaElement textarea = TextAreaElement();
Expand Down Expand Up @@ -506,7 +512,9 @@ void main() {
expect(document.body.contains(editingElement.domElement), isTrue);
// But the textarea loses focus.
expect(document.activeElement, document.body);
});
},
// TODO(nurhan): https://github.com/flutter/flutter/issues/50590
skip: browserEngine == BrowserEngine.webkit);

test('Does not position or size its DOM element', () {
editingElement.enable(
Expand All @@ -525,6 +533,7 @@ void main() {
expect(editingElement.domElement.style.width, '');
expect(editingElement.domElement.style.height, '');
}

checkPlacementIsEmpty();
editingElement.placeElement();
checkPlacementIsEmpty();
Expand Down Expand Up @@ -689,7 +698,9 @@ void main() {
);
// Input element is removed from DOM.
expect(document.getElementsByTagName('input'), hasLength(0));
});
},
// TODO(nurhan): https://github.com/flutter/flutter/issues/50590
skip: browserEngine == BrowserEngine.webkit);

test('setClient, setEditingState, show, setClient', () {
final MethodCall setClient = MethodCall(
Expand Down Expand Up @@ -808,64 +819,67 @@ void main() {

// Confirm that [HybridTextEditing] didn't send any messages.
expect(spy.messages, isEmpty);
});
},
// TODO(nurhan): https://github.com/flutter/flutter/issues/50590
skip: browserEngine == BrowserEngine.webkit);

test(
'setClient, show, setEditableSizeAndTransform, setStyle, setEditingState, clearClient',
() {
final MethodCall setClient = MethodCall(
'TextInput.setClient', <dynamic>[123, flutterSinglelineConfig]);
sendFrameworkMessage(codec.encodeMethodCall(setClient));

const MethodCall show = MethodCall('TextInput.show');
sendFrameworkMessage(codec.encodeMethodCall(show));

final MethodCall setSizeAndTransform =
configureSetSizeAndTransformMethodCall(
150,
50,
Matrix4.translationValues(
10.0,
20.0,
30.0,
).storage.toList());
sendFrameworkMessage(codec.encodeMethodCall(setSizeAndTransform));

final MethodCall setStyle =
configureSetStyleMethodCall(12, 'sans-serif', 4, 4, 1);
sendFrameworkMessage(codec.encodeMethodCall(setStyle));

const MethodCall setEditingState =
MethodCall('TextInput.setEditingState', <String, dynamic>{
'text': 'abcd',
'selectionBase': 2,
'selectionExtent': 3,
});
sendFrameworkMessage(codec.encodeMethodCall(setEditingState));

final HtmlElement domElement = textEditing.editingElement.domElement;

checkInputEditingState(domElement, 'abcd', 2, 3);

// Check if the position is correct.
expect(
domElement.getBoundingClientRect(),
Rectangle<double>.fromPoints(const Point<double>(10.0, 20.0),
const Point<double>(160.0, 70.0)),
);
expect(
domElement.style.transform,
'matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 10, 20, 30, 1)',
);
expect(
textEditing.editingElement.domElement.style.font,
'500 12px sans-serif',
);

const MethodCall clearClient = MethodCall('TextInput.clearClient');
sendFrameworkMessage(codec.encodeMethodCall(clearClient));
},
);
'setClient, show, setEditableSizeAndTransform, setStyle, setEditingState, clearClient',
() {
final MethodCall setClient = MethodCall(
'TextInput.setClient', <dynamic>[123, flutterSinglelineConfig]);
sendFrameworkMessage(codec.encodeMethodCall(setClient));

const MethodCall show = MethodCall('TextInput.show');
sendFrameworkMessage(codec.encodeMethodCall(show));

final MethodCall setSizeAndTransform =
configureSetSizeAndTransformMethodCall(
150,
50,
Matrix4.translationValues(
10.0,
20.0,
30.0,
).storage.toList());
sendFrameworkMessage(codec.encodeMethodCall(setSizeAndTransform));

final MethodCall setStyle =
configureSetStyleMethodCall(12, 'sans-serif', 4, 4, 1);
sendFrameworkMessage(codec.encodeMethodCall(setStyle));

const MethodCall setEditingState =
MethodCall('TextInput.setEditingState', <String, dynamic>{
'text': 'abcd',
'selectionBase': 2,
'selectionExtent': 3,
});
sendFrameworkMessage(codec.encodeMethodCall(setEditingState));

final HtmlElement domElement = textEditing.editingElement.domElement;

checkInputEditingState(domElement, 'abcd', 2, 3);

// Check if the position is correct.
expect(
domElement.getBoundingClientRect(),
Rectangle<double>.fromPoints(
const Point<double>(10.0, 20.0), const Point<double>(160.0, 70.0)),
);
expect(
domElement.style.transform,
'matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 10, 20, 30, 1)',
);
expect(
textEditing.editingElement.domElement.style.font,
'500 12px sans-serif',
);

const MethodCall clearClient = MethodCall('TextInput.clearClient');
sendFrameworkMessage(codec.encodeMethodCall(clearClient));
},
// TODO(nurhan): https://github.com/flutter/flutter/issues/50590
skip: browserEngine == BrowserEngine.webkit);

test('input font set succesfully with null fontWeightIndex', () {
final MethodCall setClient = MethodCall(
Expand Down Expand Up @@ -907,7 +921,9 @@ void main() {
textEditing.editingElement.domElement.style.font, '12px sans-serif');

hideKeyboard();
});
},
// TODO(nurhan): https://github.com/flutter/flutter/issues/50590
skip: browserEngine == BrowserEngine.webkit);

test(
'negative base offset and selection extent values in editing state is handled',
Expand Down Expand Up @@ -1172,7 +1188,8 @@ void main() {
EditingState _editingState;

setUp(() {
editingElement = GloballyPositionedTextEditingStrategy(HybridTextEditing());
editingElement =
GloballyPositionedTextEditingStrategy(HybridTextEditing());
editingElement.enable(
singlelineConfig,
onChange: trackEditingState,
Expand Down
Loading

0 comments on commit 44e80fd

Please sign in to comment.