Fix Generation of Tests from Fixtures

Summary:
https://github.com/facebook/yoga/pull/1116 added a change to the test generator "gentests.rb" to support a newer version of chromedriver, along with a change to the enum generator (not touched in this diff) to produce code consistent with the current tests, which seem to have been manually edited since last generation.

I had trouble running the test generator locally, because it relies on unversioned third-party dependencies, whose APIs change. Looking at source history, it seems like each time someone wants to run the script, they end up updating its syntax to match whatever versions they pull in.

This change adds a Gemfile and lock so that that the version of "watir" is locked, and so that we will also automatically pull in a consistent "chomedriver" version via the "webdrivers" gem. It includes the updates from the PR to be consistent with already output tests, and I have also updated the copyright header generation to no longer create lint warnings on newly generated tests (some of the previous ones were fixed manually it looks like).

The test generator would still produce bodies which would fail clang-format, and were manually edited (causing generation to emit new lint warnings), so I updated the generator to suppress clang-format in the body of the generated files.

Three tests, around the interaction of minimum dimensions and flexible children produce different results in Chrome now compared to when the tests were added, so running `gentests.rb` creates tests which break UTs. This doesn't seem like any sort of rounding, or device specific difference, so I have disabled these tests for now. While digging around, it does look like Chrome periodically will fix bugs in its own layout implementation which cause differences, like https://bugs.chromium.org/p/chromium/issues/detail?id=927066

Reviewed By: rozele, Andrey-Mishanin

Differential Revision: D39907416

fbshipit-source-id: f88714ff038b42f935901783452df25eabb6ebb1
This commit is contained in:
Nick Gerleman
2022-09-29 22:25:24 -07:00
committed by Facebook GitHub Bot
parent 7d37b2e84b
commit fd180de774
80 changed files with 540 additions and 1515 deletions

View File

@@ -1,5 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
@@ -10,24 +10,28 @@ window.onload = function() {
printTest(
new CPPEmitter(),
'cpp',
document.body.children[0],
document.body.children[1],
document.body.children[2]);
printTest(
new JavaEmitter(),
'java',
document.body.children[0],
document.body.children[1],
document.body.children[2]);
printTest(
new CSEmitter(),
'cs',
document.body.children[0],
document.body.children[1],
document.body.children[2]);
printTest(
new JavascriptEmitter(),
'js',
document.body.children[0],
document.body.children[1],
document.body.children[2]);
@@ -39,14 +43,15 @@ function assert(condition, message) {
}
}
function printTest(e, LTRContainer, RTLContainer, genericContainer) {
function printTest(e, ext, LTRContainer, RTLContainer, genericContainer) {
e.push([
'/*',
' * Copyright (c) Facebook, Inc. and its affiliates.',
ext === 'js' ? '/**' : '/*',
' * Copyright (c) Meta Platforms, Inc. and affiliates.',
' *',
' * This source code is licensed under the MIT license found in the',
' * LICENSE file in the root directory of this source tree.',
' */',
ext === 'cpp' ? '\n// clang-format off' : '',
'// @Generated by gentest/gentest.rb from gentest/fixtures/' + document.title + '.html',
'',
]);