c3d5831e05
Changed the render_pictures, bench_pictures and test_pictures.py so that multiple inputs can be given. Furthermore, specific files can also be specified. Unit tests have also been added for picture_utils.cpp. Committed http://code.google.com/p/skia/source/detail?r=4486 Review URL: https://codereview.appspot.com/6345054 git-svn-id: http://skia.googlecode.com/svn/trunk@4488 2bbb7eff-a529-9590-31e7-b0007b416f81
55 lines
1.5 KiB
C++
55 lines
1.5 KiB
C++
/*
|
|
* Copyright 2012 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
#include "Test.h"
|
|
#include "picture_utils.h"
|
|
#include "SkString.h"
|
|
|
|
static void test_filepath_creation(skiatest::Reporter* reporter) {
|
|
SkString result;
|
|
SkString filename("test");
|
|
const char* dir = "test/path";
|
|
sk_tools::make_filepath(&result, dir, filename);
|
|
REPORTER_ASSERT(reporter, result.equals("test/path/test"));
|
|
}
|
|
|
|
static void test_get_basename(skiatest::Reporter* reporter) {
|
|
SkString result;
|
|
SkString path("/path/basename");
|
|
sk_tools::get_basename(&result, path);
|
|
REPORTER_ASSERT(reporter, result.equals("basename"));
|
|
|
|
result.reset();
|
|
path.set("/path/dir/");
|
|
sk_tools::get_basename(&result, path);
|
|
REPORTER_ASSERT(reporter, result.equals("dir"));
|
|
|
|
result.reset();
|
|
path.set("path");
|
|
sk_tools::get_basename(&result, path);
|
|
REPORTER_ASSERT(reporter, result.equals("path"));
|
|
|
|
#if defined(SK_BUILD_FOR_WIN)
|
|
result.reset();
|
|
path.set("path\\winbasename");
|
|
sk_tools::get_basename(&result, path);
|
|
REPORTER_ASSERT(reporter, result.equals("winbasename"));
|
|
|
|
result.reset();
|
|
path.set("path\\windir\\");
|
|
sk_tools::get_basename(&result, path);
|
|
REPORTER_ASSERT(reporter, result.equals("windir"));
|
|
#endif
|
|
}
|
|
|
|
static void TestPictureUtils(skiatest::Reporter* reporter) {
|
|
test_filepath_creation(reporter);
|
|
test_get_basename(reporter);
|
|
}
|
|
|
|
#include "TestClassDef.h"
|
|
DEFINE_TESTCLASS("PictureUtils", PictureUtilsTestClass, TestPictureUtils)
|