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

Side by Side Diff: tests/SurfaceTest.cpp

Issue 25716003: Make it explicit that some validate methods are debug only ... (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/core/SkPathRef.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2013 Google Inc. 3 * Copyright 2013 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkRRect.h" 9 #include "SkRRect.h"
10 #include "SkSurface.h" 10 #include "SkSurface.h"
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 SurfaceType surfaceType, 202 SurfaceType surfaceType,
203 GrContext* context, 203 GrContext* context,
204 SkSurface::ContentChangeMode mode) { 204 SkSurface::ContentChangeMode mode) {
205 // Verifies the robustness of SkSurface for handling use cases where calls 205 // Verifies the robustness of SkSurface for handling use cases where calls
206 // are made before a canvas is created. 206 // are made before a canvas is created.
207 { 207 {
208 // Test passes by not asserting 208 // Test passes by not asserting
209 SkSurface* surface = createSurface(surfaceType, context); 209 SkSurface* surface = createSurface(surfaceType, context);
210 SkAutoTUnref<SkSurface> aur_surface(surface); 210 SkAutoTUnref<SkSurface> aur_surface(surface);
211 surface->notifyContentWillChange(mode); 211 surface->notifyContentWillChange(mode);
212 surface->validate(); 212 SkDEBUGCODE(surface->validate();)
213 } 213 }
214 { 214 {
215 SkSurface* surface = createSurface(surfaceType, context); 215 SkSurface* surface = createSurface(surfaceType, context);
216 SkAutoTUnref<SkSurface> aur_surface(surface); 216 SkAutoTUnref<SkSurface> aur_surface(surface);
217 SkImage* image1 = surface->newImageSnapshot(); 217 SkImage* image1 = surface->newImageSnapshot();
218 SkAutoTUnref<SkImage> aur_image1(image1); 218 SkAutoTUnref<SkImage> aur_image1(image1);
219 image1->validate(); 219 SkDEBUGCODE(image1->validate();)
220 surface->validate(); 220 SkDEBUGCODE(surface->validate();)
221 surface->notifyContentWillChange(mode); 221 surface->notifyContentWillChange(mode);
222 image1->validate(); 222 SkDEBUGCODE(image1->validate();)
223 surface->validate(); 223 SkDEBUGCODE(surface->validate();)
224 SkImage* image2 = surface->newImageSnapshot(); 224 SkImage* image2 = surface->newImageSnapshot();
225 SkAutoTUnref<SkImage> aur_image2(image2); 225 SkAutoTUnref<SkImage> aur_image2(image2);
226 image2->validate(); 226 SkDEBUGCODE(image2->validate();)
227 surface->validate(); 227 SkDEBUGCODE(surface->validate();)
228 REPORTER_ASSERT(reporter, image1 != image2); 228 REPORTER_ASSERT(reporter, image1 != image2);
229 } 229 }
230 230
231 } 231 }
232 232
233 static void TestSurface(skiatest::Reporter* reporter, GrContextFactory* factory) { 233 static void TestSurface(skiatest::Reporter* reporter, GrContextFactory* factory) {
234 TestSurfaceCopyOnWrite(reporter, kRaster_SurfaceType, NULL); 234 TestSurfaceCopyOnWrite(reporter, kRaster_SurfaceType, NULL);
235 TestSurfaceCopyOnWrite(reporter, kPicture_SurfaceType, NULL); 235 TestSurfaceCopyOnWrite(reporter, kPicture_SurfaceType, NULL);
236 TestSurfaceWritableAfterSnapshotRelease(reporter, kRaster_SurfaceType, NULL) ; 236 TestSurfaceWritableAfterSnapshotRelease(reporter, kRaster_SurfaceType, NULL) ;
237 TestSurfaceWritableAfterSnapshotRelease(reporter, kPicture_SurfaceType, NULL ); 237 TestSurfaceWritableAfterSnapshotRelease(reporter, kPicture_SurfaceType, NULL );
238 TestSurfaceNoCanvas(reporter, kRaster_SurfaceType, NULL, SkSurface::kDiscard _ContentChangeMode); 238 TestSurfaceNoCanvas(reporter, kRaster_SurfaceType, NULL, SkSurface::kDiscard _ContentChangeMode);
239 TestSurfaceNoCanvas(reporter, kRaster_SurfaceType, NULL, SkSurface::kRetain_ ContentChangeMode); 239 TestSurfaceNoCanvas(reporter, kRaster_SurfaceType, NULL, SkSurface::kRetain_ ContentChangeMode);
240 #if SK_SUPPORT_GPU 240 #if SK_SUPPORT_GPU
241 TestGetTexture(reporter, kRaster_SurfaceType, NULL); 241 TestGetTexture(reporter, kRaster_SurfaceType, NULL);
242 TestGetTexture(reporter, kPicture_SurfaceType, NULL); 242 TestGetTexture(reporter, kPicture_SurfaceType, NULL);
243 if (NULL != factory) { 243 if (NULL != factory) {
244 GrContext* context = factory->get(GrContextFactory::kNative_GLContextTyp e); 244 GrContext* context = factory->get(GrContextFactory::kNative_GLContextTyp e);
245 Test_crbug263329(reporter, context); 245 Test_crbug263329(reporter, context);
246 TestSurfaceCopyOnWrite(reporter, kGpu_SurfaceType, context); 246 TestSurfaceCopyOnWrite(reporter, kGpu_SurfaceType, context);
247 TestSurfaceWritableAfterSnapshotRelease(reporter, kGpu_SurfaceType, cont ext); 247 TestSurfaceWritableAfterSnapshotRelease(reporter, kGpu_SurfaceType, cont ext);
248 TestSurfaceNoCanvas(reporter, kGpu_SurfaceType, context, SkSurface::kDis card_ContentChangeMode); 248 TestSurfaceNoCanvas(reporter, kGpu_SurfaceType, context, SkSurface::kDis card_ContentChangeMode);
249 TestSurfaceNoCanvas(reporter, kGpu_SurfaceType, context, SkSurface::kRet ain_ContentChangeMode); 249 TestSurfaceNoCanvas(reporter, kGpu_SurfaceType, context, SkSurface::kRet ain_ContentChangeMode);
250 TestGetTexture(reporter, kGpu_SurfaceType, context); 250 TestGetTexture(reporter, kGpu_SurfaceType, context);
251 } 251 }
252 #endif 252 #endif
253 } 253 }
254 254
255 #include "TestClassDef.h" 255 #include "TestClassDef.h"
256 DEFINE_GPUTESTCLASS("Surface", SurfaceTestClass, TestSurface) 256 DEFINE_GPUTESTCLASS("Surface", SurfaceTestClass, TestSurface)
OLDNEW
« no previous file with comments | « src/core/SkPathRef.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698