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

Side by Side Diff: tests/KtxTest.cpp

Issue 687453005: not a failure if we didn't load the test file (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « no previous file | 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 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * 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
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "Resources.h" 8 #include "Resources.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkData.h" 10 #include "SkData.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 * Finally, make sure that if we get ETC1 data from a PKM file that we can then 138 * Finally, make sure that if we get ETC1 data from a PKM file that we can then
139 * accurately write it out into a KTX file (i.e. transferring the ETC1 data from 139 * accurately write it out into a KTX file (i.e. transferring the ETC1 data from
140 * the PKM to the KTX should produce an identical KTX to the one we have on file ) 140 * the PKM to the KTX should produce an identical KTX to the one we have on file )
141 */ 141 */
142 DEF_TEST(KtxReexportPKM, reporter) { 142 DEF_TEST(KtxReexportPKM, reporter) {
143 SkString pkmFilename = GetResourcePath("mandrill_128.pkm"); 143 SkString pkmFilename = GetResourcePath("mandrill_128.pkm");
144 144
145 // Load PKM file into a bitmap 145 // Load PKM file into a bitmap
146 SkBitmap etcBitmap; 146 SkBitmap etcBitmap;
147 SkAutoTUnref<SkData> fileData(SkData::NewFromFileName(pkmFilename.c_str())); 147 SkAutoTUnref<SkData> fileData(SkData::NewFromFileName(pkmFilename.c_str()));
148 REPORTER_ASSERT(reporter, fileData);
149 if (NULL == fileData) { 148 if (NULL == fileData) {
149 SkDebugf("KtxReexportPKM: can't load test file %s\n", pkmFilename.c_str( ));
150 return; 150 return;
151 } 151 }
152 152
153 bool installDiscardablePixelRefSuccess = 153 bool installDiscardablePixelRefSuccess =
154 SkInstallDiscardablePixelRef( 154 SkInstallDiscardablePixelRef(
155 SkDecodingImageGenerator::Create( 155 SkDecodingImageGenerator::Create(
156 fileData, SkDecodingImageGenerator::Options()), &etcBitmap); 156 fileData, SkDecodingImageGenerator::Options()), &etcBitmap);
157 REPORTER_ASSERT(reporter, installDiscardablePixelRefSuccess); 157 REPORTER_ASSERT(reporter, installDiscardablePixelRefSuccess);
158 158
159 // Write the bitmap out to a KTX file. 159 // Write the bitmap out to a KTX file.
160 SkData *ktxDataPtr = SkImageEncoder::EncodeData(etcBitmap, SkImageEncoder::k KTX_Type, 0); 160 SkData *ktxDataPtr = SkImageEncoder::EncodeData(etcBitmap, SkImageEncoder::k KTX_Type, 0);
161 SkAutoDataUnref newKtxData(ktxDataPtr); 161 SkAutoDataUnref newKtxData(ktxDataPtr);
162 REPORTER_ASSERT(reporter, ktxDataPtr); 162 REPORTER_ASSERT(reporter, ktxDataPtr);
163 163
164 // See is this data is identical to data in existing ktx file. 164 // See is this data is identical to data in existing ktx file.
165 SkString ktxFilename = GetResourcePath("mandrill_128.ktx"); 165 SkString ktxFilename = GetResourcePath("mandrill_128.ktx");
166 SkAutoDataUnref oldKtxData(SkData::NewFromFileName(ktxFilename.c_str())); 166 SkAutoDataUnref oldKtxData(SkData::NewFromFileName(ktxFilename.c_str()));
167 REPORTER_ASSERT(reporter, oldKtxData->equals(newKtxData)); 167 REPORTER_ASSERT(reporter, oldKtxData->equals(newKtxData));
168 } 168 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698