blob: fbe8448359a730dcf95021f44853527a6787b6ad [file] [log] [blame]
commit-bot@chromium.orgc4b21e62014-04-11 18:33:31 +00001/*
2 * Copyright 2014 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
commit-bot@chromium.org18fd2b92014-04-10 23:30:59 +00008#include "Test.h"
9
10#include "SkRecording.h"
11
12// Minimally exercise the public SkRecording API.
13
14DEF_TEST(RecordingTest, r) {
commit-bot@chromium.org732bd662014-04-24 15:22:55 +000015 EXPERIMENTAL::SkRecording recording(1920, 1080);
commit-bot@chromium.org18fd2b92014-04-10 23:30:59 +000016
17 // Some very exciting commands here.
commit-bot@chromium.org732bd662014-04-24 15:22:55 +000018 recording.canvas()->clipRect(SkRect::MakeWH(320, 240));
commit-bot@chromium.org18fd2b92014-04-10 23:30:59 +000019
commit-bot@chromium.org732bd662014-04-24 15:22:55 +000020 SkAutoTDelete<const EXPERIMENTAL::SkPlayback> playback(recording.releasePlayback());
commit-bot@chromium.org18fd2b92014-04-10 23:30:59 +000021
22 SkCanvas target;
23 playback->draw(&target);
commit-bot@chromium.org732bd662014-04-24 15:22:55 +000024
25 // Here's another recording we never call releasePlayback().
26 // However pointless, this should be safe.
27 EXPERIMENTAL::SkRecording pointless(1920, 1080);
28 pointless.canvas()->clipRect(SkRect::MakeWH(320, 240));
commit-bot@chromium.org18fd2b92014-04-10 23:30:59 +000029}