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

Side by Side Diff: site/dev/contrib/submit.md

Issue 885133002: documentation: Writing Unit and Rendering Tests (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Another Patch Set Created 5 years, 10 months 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 | « no previous file | site/dev/contrib/tests.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 How to submit a patch 1 How to submit a patch
2 ===================== 2 =====================
3 3
4 4
5 Making changes 5 Making changes
6 -------------- 6 --------------
7 7
8 First create a branch for your changes: 8 First create a branch for your changes:
9 9
10 ~~~~ 10 ~~~~
(...skipping 14 matching lines...) Expand all
25 $ gclient sync 25 $ gclient sync
26 ~~~~ 26 ~~~~
27 27
28 28
29 Adding a unit test 29 Adding a unit test
30 ------------------ 30 ------------------
31 31
32 If you are willing to change Skia codebase, it's nice to add a test at the same 32 If you are willing to change Skia codebase, it's nice to add a test at the same
33 time. Skia has a simple unittest framework so you can add a case to it. 33 time. Skia has a simple unittest framework so you can add a case to it.
34 34
35 Test code is located under the 'tests' directory. Assuming we are adding 35 Test code is located under the 'tests' directory.
36 tests/FooTest.cpp, The test code will look like:
37 36
38 <!--?prettify?--> 37 See [Writing Unit and Rendering Tests](tests) for details.
39 ~~~~
40 /*
41 * Copyright ........
42 *
43 * Use of this source code is governed by a BSD-style license that can be
44 * found in the LICENSE file.
45 */
46
47 #include "Test.h"
48
49 DEF_TEST(TestFoo, reporter) {
50 int x = 2 * 3;
51 if (x != 6) {
52 ERRORF(reporter, "x should be 6, but is %d", x);
53 return;
54 }
55 REPORTER_ASSERT(reporter, 1 + 1 == 2);
56 }
57 ~~~~
58
59 And we need to add this new file to gyp/tests.gyp. Note that file names are
60 sorted alphabetically.
61
62 <!--?prettify?-->
63 ~~~~
64 'sources': [
65 '../tests/AAClipTest.cpp'
66 '../tests/FooTest.cpp',
67 '../tests/XfermodeTest.cpp',
68 ],
69 ~~~~
70 38
71 Unit tests are best, but if your change touches rendering and you can't think of 39 Unit tests are best, but if your change touches rendering and you can't think of
72 an automated way to verify the results, consider writing a GM test or a new page 40 an automated way to verify the results, consider writing a GM test or a new page
73 of SampleApp. Also, if your change is the GPU code, you may not be able to write 41 of SampleApp. Also, if your change is the GPU code, you may not be able to write
74 it as part of the standard unit test suite, but there are GPU-specific testing 42 it as part of the standard unit test suite, but there are GPU-specific testing
75 paths you can extend. 43 paths you can extend.
76 44
77
78 Submitting a patch 45 Submitting a patch
79 ------------------ 46 ------------------
80 47
81 For your code to be accepted into the codebase, you must complete the 48 For your code to be accepted into the codebase, you must complete the
82 [Individual Contributor License 49 [Individual Contributor License
83 Agreement](http://code.google.com/legal/individual-cla-v1.0.html). You can do 50 Agreement](http://code.google.com/legal/individual-cla-v1.0.html). You can do
84 this online, and it only takes a minute. If you are contributing on behalf of a 51 this online, and it only takes a minute. If you are contributing on behalf of a
85 corporation, you must fill out the [Corporate Contributor License Agreement](htt p://code.google.com/legal/corporate-cla-v1.0.html) 52 corporation, you must fill out the [Corporate Contributor License Agreement](htt p://code.google.com/legal/corporate-cla-v1.0.html)
86 and send it to us as described on that page. Add your (or your organization's) 53 and send it to us as described on that page. Add your (or your organization's)
87 name and contact info to the AUTHORS file as a part of your CL. 54 name and contact info to the AUTHORS file as a part of your CL.
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 206
240 git-cl will squash all your commits into a single one with the description you u sed when you uploaded your change. 207 git-cl will squash all your commits into a single one with the description you u sed when you uploaded your change.
241 208
242 ~~~~ 209 ~~~~
243 git cl land 210 git cl land
244 ~~~~ 211 ~~~~
245 or 212 or
246 ~~~~ 213 ~~~~
247 git cl land -c 'Contributor Name <email@example.com>' 214 git cl land -c 'Contributor Name <email@example.com>'
248 ~~~~ 215 ~~~~
OLDNEW
« no previous file with comments | « no previous file | site/dev/contrib/tests.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698