Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: site/dev/testing/tests.md

Issue 1439493003: Documentation: clean up (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-11-13 (Friday) 07:21:08 EST Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « site/dev/testing/testing.md ('k') | site/dev/tools/debugger.md » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 Writing Unit and Rendering Tests 1 Writing Unit and Rendering Tests
2 ================================ 2 ================================
3 3
4 Writing a Unit Test 4 Writing a Unit Test
5 ------------------- 5 -------------------
6 6
7 1. Add a file `tests/NewUnitTest.cpp`: 7 1. Add a file `tests/NewUnitTest.cpp`:
8 8
9 <!--?prettify lang=cc?--> 9 <!--?prettify lang=cc?-->
10 10
11 /* 11 /*
12 * Copyright ........ 12 * Copyright ........
13 * 13 *
14 * Use of this source code is governed by a BSD-style license 14 * Use of this source code is governed by a BSD-style license
15 * that can be found in the LICENSE file. 15 * that can be found in the LICENSE file.
16 */ 16 */
17 #include "Test.h" 17 #include "Test.h"
18 DEF_TEST(NewUnitTest, reporter) { 18 DEF_TEST(NewUnitTest, reporter) {
19 if (1 + 1 != 2) { 19 if (1 + 1 != 2) {
20 ERRORF(reporter, "%d + %d != %d", 1, 1, 2); 20 ERRORF(reporter, "%d + %d != %d", 1, 1, 2);
21 } 21 }
22 bool lifeIsGood = true; 22 bool lifeIsGood = true;
23 REPORTER_ASSERT(reporter, lifeIsGood); 23 REPORTER_ASSERT(reporter, lifeIsGood);
24 } 24 }
25 25
26 2. Recompile and run test: 26 2. Recompile and run test:
27 27
28 ./gyp_skia 28 python bin/sync-and-gyp
29 ninja -C out/Debug dm 29 ninja -C out/Debug dm
30 out/Debug/dm --match NewUnitTest 30 out/Debug/dm --match NewUnitTest
31 31
32 Writing a Rendering Test 32 Writing a Rendering Test
33 ------------------------ 33 ------------------------
34 34
35 1. Add a file `gm/newgmtest.cpp`: 35 1. Add a file `gm/newgmtest.cpp`:
36 36
37 <!--?prettify lang=cc?--> 37 <!--?prettify lang=cc?-->
38 38
39 /* 39 /*
40 * Copyright ........ 40 * Copyright ........
41 * 41 *
42 * Use of this source code is governed by a BSD-style license 42 * Use of this source code is governed by a BSD-style license
43 * that can be found in the LICENSE file. 43 * that can be found in the LICENSE file.
44 */ 44 */
45 #include "gm.h" 45 #include "gm.h"
46 DEF_SIMPLE_GM(newgmtest, canvas, 128, 128) { 46 DEF_SIMPLE_GM(newgmtest, canvas, 128, 128) {
47 canvas->clear(SK_ColorWHITE); 47 canvas->clear(SK_ColorWHITE);
48 SkPaint p; 48 SkPaint p;
49 p.setStrokeWidth(2); 49 p.setStrokeWidth(2);
50 canvas->drawLine(16, 16, 112, 112, p); 50 canvas->drawLine(16, 16, 112, 112, p);
51 } 51 }
52 52
53 2. Recompile and run test: 53 2. Recompile and run test:
54 54
55 ./gyp_skia 55 python bin/sync-and-gyp
56 ninja -C out/Debug dm 56 ninja -C out/Debug dm
57 out/Debug/dm --match newgmtest 57 out/Debug/dm --match newgmtest
58 58
59 3. Run the GM inside SampleApp: 59 3. Run the GM inside SampleApp:
60 60
61 ./gyp_skia 61 python bin/sync-and-gyp
62 ninja -C out/Debug SampleApp 62 ninja -C out/Debug SampleApp
63 out/Debug/SampleApp --slide GM:newgmtest 63 out/Debug/SampleApp --slide GM:newgmtest
64 64
65 On MacOS, try this: 65 On MacOS, try this:
66 66
67 out/Debug/SampleApp.app/Contents/MacOS/SampleApp --slide GM:newgmtest 67 out/Debug/SampleApp.app/Contents/MacOS/SampleApp --slide GM:newgmtest
OLDNEW
« no previous file with comments | « site/dev/testing/testing.md ('k') | site/dev/tools/debugger.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698