152771272f4f018f4fc6846224bf047497e784af1Stan Iliev/* 252771272f4f018f4fc6846224bf047497e784af1Stan Iliev * Copyright (C) 2016 The Android Open Source Project 352771272f4f018f4fc6846224bf047497e784af1Stan Iliev * 452771272f4f018f4fc6846224bf047497e784af1Stan Iliev * Licensed under the Apache License, Version 2.0 (the "License"); 552771272f4f018f4fc6846224bf047497e784af1Stan Iliev * you may not use this file except in compliance with the License. 652771272f4f018f4fc6846224bf047497e784af1Stan Iliev * You may obtain a copy of the License at 752771272f4f018f4fc6846224bf047497e784af1Stan Iliev * 852771272f4f018f4fc6846224bf047497e784af1Stan Iliev * http://www.apache.org/licenses/LICENSE-2.0 952771272f4f018f4fc6846224bf047497e784af1Stan Iliev * 1052771272f4f018f4fc6846224bf047497e784af1Stan Iliev * Unless required by applicable law or agreed to in writing, software 1152771272f4f018f4fc6846224bf047497e784af1Stan Iliev * distributed under the License is distributed on an "AS IS" BASIS, 1252771272f4f018f4fc6846224bf047497e784af1Stan Iliev * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1352771272f4f018f4fc6846224bf047497e784af1Stan Iliev * See the License for the specific language governing permissions and 1452771272f4f018f4fc6846224bf047497e784af1Stan Iliev * limitations under the License. 1552771272f4f018f4fc6846224bf047497e784af1Stan Iliev */ 1652771272f4f018f4fc6846224bf047497e784af1Stan Iliev 1752771272f4f018f4fc6846224bf047497e784af1Stan Iliev#pragma once 1852771272f4f018f4fc6846224bf047497e784af1Stan Iliev 1952771272f4f018f4fc6846224bf047497e784af1Stan Iliev#include <SkCanvas.h> 201bcacfdcab0eaa0cee92bd7f5a1b5e271dd68e52John Reck#include <gtest/gtest.h> 2152771272f4f018f4fc6846224bf047497e784af1Stan Iliev 2252771272f4f018f4fc6846224bf047497e784af1Stan Ilievnamespace { 2352771272f4f018f4fc6846224bf047497e784af1Stan Iliev 2452771272f4f018f4fc6846224bf047497e784af1Stan Ilievclass TestCanvasBase : public SkCanvas { 2552771272f4f018f4fc6846224bf047497e784af1Stan Ilievpublic: 261bcacfdcab0eaa0cee92bd7f5a1b5e271dd68e52John Reck TestCanvasBase(int width, int height) : SkCanvas(width, height) {} 2752771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawAnnotation(const SkRect&, const char key[], SkData* value) { 2852771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawAnnotation not expected in this test"; 2952771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 3052771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) { 3152771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawDRRect not expected in this test"; 3252771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 3352771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y, 341bcacfdcab0eaa0cee92bd7f5a1b5e271dd68e52John Reck const SkPaint& paint) { 3552771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawText not expected in this test"; 3652771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 3752771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawPosText(const void* text, size_t byteLength, const SkPoint pos[], 381bcacfdcab0eaa0cee92bd7f5a1b5e271dd68e52John Reck const SkPaint& paint) { 3952771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawPosText not expected in this test"; 4052771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 4152771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[], SkScalar constY, 421bcacfdcab0eaa0cee92bd7f5a1b5e271dd68e52John Reck const SkPaint& paint) { 4352771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawPosTextH not expected in this test"; 4452771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 4552771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& path, 461bcacfdcab0eaa0cee92bd7f5a1b5e271dd68e52John Reck const SkMatrix* matrix, const SkPaint& paint) { 4752771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawTextOnPath not expected in this test"; 4852771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 4952771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawTextRSXform(const void* text, size_t byteLength, const SkRSXform[], 501bcacfdcab0eaa0cee92bd7f5a1b5e271dd68e52John Reck const SkRect* cullRect, const SkPaint& paint) { 5152771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawTextRSXform not expected in this test"; 5252771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 5352771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, const SkPaint& paint) { 5452771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawTextBlob not expected in this test"; 5552771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 5652771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4], const SkPoint texCoords[4], 571bcacfdcab0eaa0cee92bd7f5a1b5e271dd68e52John Reck SkBlendMode, const SkPaint& paint) { 5852771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawPatch not expected in this test"; 5952771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 601bcacfdcab0eaa0cee92bd7f5a1b5e271dd68e52John Reck void onDrawPaint(const SkPaint&) { ADD_FAILURE() << "onDrawPaint not expected in this test"; } 6152771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawRect(const SkRect&, const SkPaint&) { 6252771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawRect not expected in this test"; 6352771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 6452771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawRegion(const SkRegion& region, const SkPaint& paint) { 6552771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawRegion not expected in this test"; 6652771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 6752771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawOval(const SkRect&, const SkPaint&) { 6852771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawOval not expected in this test"; 6952771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 7052771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawArc(const SkRect&, SkScalar startAngle, SkScalar sweepAngle, bool useCenter, 711bcacfdcab0eaa0cee92bd7f5a1b5e271dd68e52John Reck const SkPaint&) { 7252771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawArc not expected in this test"; 7352771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 7452771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawRRect(const SkRRect&, const SkPaint&) { 7552771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawRRect not expected in this test"; 7652771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 7752771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPaint&) { 7852771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawPoints not expected in this test"; 7952771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 80871cd2dd6074544bd41a84ff38255d81a392546aMike Reed void onDrawVerticesObject(const SkVertices*, SkBlendMode, const SkPaint&) { 8152771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawVertices not expected in this test"; 8252771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 8352771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[], int count, 841bcacfdcab0eaa0cee92bd7f5a1b5e271dd68e52John Reck SkBlendMode, const SkRect* cull, const SkPaint*) { 8552771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawAtlas not expected in this test"; 8652771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 8752771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawPath(const SkPath&, const SkPaint&) { 8852771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawPath not expected in this test"; 8952771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 9052771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawImage(const SkImage*, SkScalar dx, SkScalar dy, const SkPaint*) { 9152771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawImage not expected in this test"; 9252771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 9352771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawImageRect(const SkImage*, const SkRect*, const SkRect&, const SkPaint*, 941bcacfdcab0eaa0cee92bd7f5a1b5e271dd68e52John Reck SrcRectConstraint) { 9552771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawImageRect not expected in this test"; 9652771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 9752771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawImageNine(const SkImage*, const SkIRect& center, const SkRect& dst, const SkPaint*) { 9852771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawImageNine not expected in this test"; 9952771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 10052771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawImageLattice(const SkImage*, const Lattice& lattice, const SkRect& dst, 1011bcacfdcab0eaa0cee92bd7f5a1b5e271dd68e52John Reck const SkPaint*) { 10252771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawImageLattice not expected in this test"; 10352771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 10452771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawBitmap(const SkBitmap&, SkScalar dx, SkScalar dy, const SkPaint*) { 10552771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawBitmap not expected in this test"; 10652771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 10752771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawBitmapRect(const SkBitmap&, const SkRect*, const SkRect&, const SkPaint*, 1081bcacfdcab0eaa0cee92bd7f5a1b5e271dd68e52John Reck SrcRectConstraint) { 10952771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawBitmapRect not expected in this test"; 11052771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 11152771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst, 1121bcacfdcab0eaa0cee92bd7f5a1b5e271dd68e52John Reck const SkPaint*) { 11352771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawBitmapNine not expected in this test"; 11452771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 11552771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawBitmapLattice(const SkBitmap&, const Lattice& lattice, const SkRect& dst, 1161bcacfdcab0eaa0cee92bd7f5a1b5e271dd68e52John Reck const SkPaint*) { 11752771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawBitmapLattice not expected in this test"; 11852771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 119d43eaa909018068bc1ac197839f5e2ed79d9139dMike Reed void onClipRRect(const SkRRect& rrect, SkClipOp, ClipEdgeStyle) { 12052771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onClipRRect not expected in this test"; 12152771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 122d43eaa909018068bc1ac197839f5e2ed79d9139dMike Reed void onClipPath(const SkPath& path, SkClipOp, ClipEdgeStyle) { 12352771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onClipPath not expected in this test"; 12452771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 125d43eaa909018068bc1ac197839f5e2ed79d9139dMike Reed void onClipRegion(const SkRegion& deviceRgn, SkClipOp) { 12652771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onClipRegion not expected in this test"; 12752771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 1281bcacfdcab0eaa0cee92bd7f5a1b5e271dd68e52John Reck void onDiscard() { ADD_FAILURE() << "onDiscard not expected in this test"; } 12952771272f4f018f4fc6846224bf047497e784af1Stan Iliev void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) { 13052771272f4f018f4fc6846224bf047497e784af1Stan Iliev ADD_FAILURE() << "onDrawPicture not expected in this test"; 13152771272f4f018f4fc6846224bf047497e784af1Stan Iliev } 13252771272f4f018f4fc6846224bf047497e784af1Stan Iliev 1331bcacfdcab0eaa0cee92bd7f5a1b5e271dd68e52John Reck int mDrawCounter = 0; // counts how may draw calls of any kind were made to this canvas 13452771272f4f018f4fc6846224bf047497e784af1Stan Iliev}; 13552771272f4f018f4fc6846224bf047497e784af1Stan Iliev}