danakj | 99437fc | 2021-03-05 21:27:04 | [diff] [blame] | 1 | // Copyright 2021 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 | #include "ui/gfx/image/image_skia_operations.h" |
| 6 | |
| 7 | #include "testing/gtest/include/gtest/gtest.h" |
David Sanders | 03ee601f | 2022-02-22 02:23:00 | [diff] [blame^] | 8 | #include "ui/gfx/geometry/size.h" |
danakj | 99437fc | 2021-03-05 21:27:04 | [diff] [blame] | 9 | #include "ui/gfx/image/image_skia.h" |
David Sanders | 03ee601f | 2022-02-22 02:23:00 | [diff] [blame^] | 10 | #include "ui/gfx/image/image_skia_rep.h" |
danakj | 99437fc | 2021-03-05 21:27:04 | [diff] [blame] | 11 | |
| 12 | namespace gfx { |
| 13 | namespace { |
| 14 | |
| 15 | TEST(ImageSkiaOperationsTest, ResizeFailure) { |
| 16 | ImageSkia image(ImageSkiaRep(gfx::Size(10, 10), 1.f)); |
| 17 | |
| 18 | // Try to resize to empty. This isn't a valid resize and fails gracefully. |
| 19 | ImageSkia resized = ImageSkiaOperations::CreateResizedImage( |
| 20 | image, skia::ImageOperations::RESIZE_BEST, gfx::Size()); |
| 21 | EXPECT_TRUE(resized.GetRepresentation(1.0f).is_null()); |
| 22 | } |
| 23 | |
| 24 | } // namespace |
| 25 | } // namespace gfx |