e0c64c5846
- /user/quick/desktop to bring together all common information for using Skia on desktop OSes. Remove duplication. - Replace all instances of call ing gyp_skia directly with calling `python bin/sync-and-gyp`. This is more correct on Windows - Remove outdated linux prerequisite packages - Formatting, formatting, formatting. - Note command-line syntax differences in Windows - SampleApp.app is no longer a bundle on MacOS NOTRY=true DOCS_PREVIEW= https://skia.org/?cl=1439493003 Review URL: https://codereview.chromium.org/1439493003
1.7 KiB
1.7 KiB
Writing Unit and Rendering Tests
Writing a Unit Test
-
Add a file
tests/NewUnitTest.cpp
:/* * Copyright ........ * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file. */ #include "Test.h" DEF_TEST(NewUnitTest, reporter) { if (1 + 1 != 2) { ERRORF(reporter, "%d + %d != %d", 1, 1, 2); } bool lifeIsGood = true; REPORTER_ASSERT(reporter, lifeIsGood); }
-
Recompile and run test:
python bin/sync-and-gyp ninja -C out/Debug dm out/Debug/dm --match NewUnitTest
Writing a Rendering Test
-
Add a file
gm/newgmtest.cpp
:/* * Copyright ........ * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file. */ #include "gm.h" DEF_SIMPLE_GM(newgmtest, canvas, 128, 128) { canvas->clear(SK_ColorWHITE); SkPaint p; p.setStrokeWidth(2); canvas->drawLine(16, 16, 112, 112, p); }
-
Recompile and run test:
python bin/sync-and-gyp ninja -C out/Debug dm out/Debug/dm --match newgmtest
-
Run the GM inside SampleApp:
python bin/sync-and-gyp ninja -C out/Debug SampleApp out/Debug/SampleApp --slide GM:newgmtest
On MacOS, try this:
out/Debug/SampleApp.app/Contents/MacOS/SampleApp --slide GM:newgmtest