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

Side by Side Diff: tests/SurfaceTest.cpp

Issue 132293005: Add a DEF_GPUTEST() macro. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fatory -> factory Created 6 years, 11 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 | « tests/ResourceCacheTest.cpp ('k') | tests/TestClassDef.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1
2 /* 1 /*
3 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
4 * 3 *
5 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 5 * found in the LICENSE file.
7 */ 6 */
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"
11 #include "Test.h" 11 #include "Test.h"
12 #include "TestClassDef.h"
12 13
13 #if SK_SUPPORT_GPU 14 #if SK_SUPPORT_GPU
14 #include "GrContextFactory.h" 15 #include "GrContextFactory.h"
15 #else 16 #else
16 class GrContextFactory; 17 class GrContextFactory;
17 class GrContext; 18 class GrContext;
18 #endif 19 #endif
19 20
20 enum SurfaceType { 21 enum SurfaceType {
21 kRaster_SurfaceType, 22 kRaster_SurfaceType,
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 SkDEBUGCODE(surface->validate();) 225 SkDEBUGCODE(surface->validate();)
225 SkImage* image2 = surface->newImageSnapshot(); 226 SkImage* image2 = surface->newImageSnapshot();
226 SkAutoTUnref<SkImage> aur_image2(image2); 227 SkAutoTUnref<SkImage> aur_image2(image2);
227 SkDEBUGCODE(image2->validate();) 228 SkDEBUGCODE(image2->validate();)
228 SkDEBUGCODE(surface->validate();) 229 SkDEBUGCODE(surface->validate();)
229 REPORTER_ASSERT(reporter, image1 != image2); 230 REPORTER_ASSERT(reporter, image1 != image2);
230 } 231 }
231 232
232 } 233 }
233 234
234 static void TestSurface(skiatest::Reporter* reporter, GrContextFactory* factory) { 235 DEF_GPUTEST(Surface, reporter, factory) {
235 TestSurfaceCopyOnWrite(reporter, kRaster_SurfaceType, NULL); 236 TestSurfaceCopyOnWrite(reporter, kRaster_SurfaceType, NULL);
236 TestSurfaceCopyOnWrite(reporter, kPicture_SurfaceType, NULL); 237 TestSurfaceCopyOnWrite(reporter, kPicture_SurfaceType, NULL);
237 TestSurfaceWritableAfterSnapshotRelease(reporter, kRaster_SurfaceType, NULL) ; 238 TestSurfaceWritableAfterSnapshotRelease(reporter, kRaster_SurfaceType, NULL) ;
238 TestSurfaceWritableAfterSnapshotRelease(reporter, kPicture_SurfaceType, NULL ); 239 TestSurfaceWritableAfterSnapshotRelease(reporter, kPicture_SurfaceType, NULL );
239 TestSurfaceNoCanvas(reporter, kRaster_SurfaceType, NULL, SkSurface::kDiscard _ContentChangeMode); 240 TestSurfaceNoCanvas(reporter, kRaster_SurfaceType, NULL, SkSurface::kDiscard _ContentChangeMode);
240 TestSurfaceNoCanvas(reporter, kRaster_SurfaceType, NULL, SkSurface::kRetain_ ContentChangeMode); 241 TestSurfaceNoCanvas(reporter, kRaster_SurfaceType, NULL, SkSurface::kRetain_ ContentChangeMode);
241 #if SK_SUPPORT_GPU 242 #if SK_SUPPORT_GPU
242 TestGetTexture(reporter, kRaster_SurfaceType, NULL); 243 TestGetTexture(reporter, kRaster_SurfaceType, NULL);
243 TestGetTexture(reporter, kPicture_SurfaceType, NULL); 244 TestGetTexture(reporter, kPicture_SurfaceType, NULL);
244 if (NULL != factory) { 245 if (NULL != factory) {
245 GrContext* context = factory->get(GrContextFactory::kNative_GLContextTyp e); 246 GrContext* context = factory->get(GrContextFactory::kNative_GLContextTyp e);
246 if (NULL != context) { 247 if (NULL != context) {
247 Test_crbug263329(reporter, context); 248 Test_crbug263329(reporter, context);
248 TestSurfaceCopyOnWrite(reporter, kGpu_SurfaceType, context); 249 TestSurfaceCopyOnWrite(reporter, kGpu_SurfaceType, context);
249 TestSurfaceWritableAfterSnapshotRelease(reporter, kGpu_SurfaceType, context); 250 TestSurfaceWritableAfterSnapshotRelease(reporter, kGpu_SurfaceType, context);
250 TestSurfaceNoCanvas(reporter, kGpu_SurfaceType, context, SkSurface:: kDiscard_ContentChangeMode); 251 TestSurfaceNoCanvas(reporter, kGpu_SurfaceType, context, SkSurface:: kDiscard_ContentChangeMode);
251 TestSurfaceNoCanvas(reporter, kGpu_SurfaceType, context, SkSurface:: kRetain_ContentChangeMode); 252 TestSurfaceNoCanvas(reporter, kGpu_SurfaceType, context, SkSurface:: kRetain_ContentChangeMode);
252 TestGetTexture(reporter, kGpu_SurfaceType, context); 253 TestGetTexture(reporter, kGpu_SurfaceType, context);
253 } 254 }
254 } 255 }
255 #endif 256 #endif
256 } 257 }
257
258 #include "TestClassDef.h"
259 DEFINE_GPUTESTCLASS("Surface", SurfaceTestClass, TestSurface)
OLDNEW
« no previous file with comments | « tests/ResourceCacheTest.cpp ('k') | tests/TestClassDef.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698