webpackJsonp([0xf3d9d8da20b1],{512:function(n,t){n.exports={pathContext:{frontmatter:{path:"contributing/testing",hasPlayground:!1,initialPlayground:null,redirect:null},html:'

Testing

\n

Yoga tries to be as close as possible to chrome in its flexbox behaviour.\nTo ensure this most of Yoga\'s test suite is automatically generateded from\nrunning the corresponding layout in chrome using a webdriver which then generates\nC++ test which asserts that Yoga will produce matching outputs for that layout.

\n

Running the Test Suite

\n
    \n
  1. Yoga builds with buck. Follow their documentation to get up and running.
  2. \n
  3. For testing Yoga relies on gtest as a submodule. After cloning Yoga run git submodule init followed by git submodule update.
  4. \n
  5. In a terminal from the root of your Yoga checkout run buck test //:yoga.
  6. \n
\n

Adding a Test

\n

Instead of manually writing a test which ensures parity with web implementations\nof Flexbox we make use of a generated test suite. We use gentest/gentest.rb to\ngenerate this test suite. Write the html which you want to verify in Yoga and put\nit in the gentest/fixtures folder, such as the following.

\n
\n
<div id="my_test" style="width: 100px; height: 100px; align-items: center;">\n  <div style="width: 50px; height: 50px;"></div>\n</div>\n
\n
\n

Run gentest/gentest.rb to generate test code and re-run buck test //:yoga\nto validate the behavior. One test case will be generated for every root div\nin the input html with the string in the id corresponding to the test name.

\n

You may need to install the latest watir gem (gem install watir) and\nChromeDriver to\nrun gentest/gentest.rb Ruby script.

\n

Manual test

\n

For some aspects of Yoga we cannot generate a test using the test generation\ninfrastructure described earlier. For these cases we manually write a test in\nthe /tests directory.\t

'}}}}); //# sourceMappingURL=path---contributing-testing-e651254efd99ce50eeb7.js.map