 Chromium Code Reviews
 Chromium Code Reviews Issue 6849030:
  Add support for multi resolution icons   (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src
    
  
    Issue 6849030:
  Add support for multi resolution icons   (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src| OLD | NEW | 
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #import <Cocoa/Cocoa.h> | |
| 6 | |
| 7 #include "base/file_path.h" | |
| 8 #include "base/file_util.h" | |
| 9 #include "base/memory/scoped_nsobject.h" | |
| 10 #include "base/path_service.h" | |
| 11 #include "base/sys_string_conversions.h" | |
| 12 #include "testing/gtest/include/gtest/gtest.h" | |
| 13 #include "third_party/skia/include/core/SkBitmap.h" | |
| 14 #include "ui/gfx/codec/tiff_codec.h" | |
| 15 | |
| 16 namespace gfx { | |
| 17 | |
| 18 #if defined(OS_MACOSX) | |
| 19 TEST(TIFFCodecMac, DecodeMultiImage) { | |
| 20 NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; | |
| 
Robert Sesek
2011/04/14 18:42:44
base::ScopedNSAutoreleasePool
 | |
| 21 | |
| 22 FilePath data_path; | |
| 23 ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &data_path)); | |
| 24 data_path = data_path.Append(FILE_PATH_LITERAL( | |
| 25 "../ui/gfx/test/data/tiff_codec_unittest/two_images.tiff")); | |
| 26 | |
| 27 NSString* path = base::SysUTF8ToNSString(data_path.value()); | |
| 28 scoped_nsobject<NSImage> image([[NSImage alloc] initWithContentsOfFile:path]); | |
| 29 ASSERT_TRUE(image.get()); | |
| 30 EXPECT_EQ(2u, [[image representations] count]); | |
| 31 | |
| 32 scoped_nsobject<NSData> data([[NSData alloc] initWithContentsOfFile:path]); | |
| 33 EXPECT_TRUE(data.get()); | |
| 34 | |
| 35 std::vector<SkBitmap> bitmaps; | |
| 36 EXPECT_TRUE(TIFFCodec::Decode(static_cast<const unsigned char*>([data bytes]), | |
| 37 [data length], bitmaps)); | |
| 38 EXPECT_EQ(2u, bitmaps.size()); | |
| 39 EXPECT_FALSE(bitmaps[0].isNull()); | |
| 40 EXPECT_FALSE(bitmaps[1].isNull()); | |
| 41 | |
| 42 [pool drain]; | |
| 43 } | |
| 44 #endif | |
| 45 | |
| 46 } // namespace gfx | |
| OLD | NEW |