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

Unified Diff: ios/chrome/browser/ui/ui_util_unittest.mm

Issue 2645653003: Expose thumbnails of pages to iOS share extensions. (Closed)
Patch Set: Addressed comments. Created 3 years, 10 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/chrome/browser/ui/ui_util.mm ('k') | ios/chrome/browser/ui/uikit_ui_util_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/ui/ui_util_unittest.mm
diff --git a/ios/chrome/browser/ui/ui_util_unittest.mm b/ios/chrome/browser/ui/ui_util_unittest.mm
index 33f4679d8cc7cf799e22e65fbd7dcaad470ae0b3..a7b8e8e5b7f813e0f08da05198e6b9843c32c97c 100644
--- a/ios/chrome/browser/ui/ui_util_unittest.mm
+++ b/ios/chrome/browser/ui/ui_util_unittest.mm
@@ -204,6 +204,33 @@ TEST(UIUtilTest, TestProjectionAspectFill) {
EXPECT_EQ_SIZE(expectedRevisedSize, revisedSize);
}
+TEST(UIUtilTest, TestProjectionAspectFillAlignTop) {
+ CGSize originalSize, targetSize, expectedRevisedSize, revisedSize;
+ CGRect expectedProjection, projection;
+
+ // Landscape resize to 100x100
+ originalSize = CGSizeMake(400, 200);
+ targetSize = CGSizeMake(100, 100);
+ expectedRevisedSize = targetSize;
+ expectedProjection = CGRectMake(-50, 0, 200, 100);
+ CalculateProjection(originalSize, targetSize,
+ ProjectionMode::kAspectFillAlignTop, revisedSize,
+ projection);
+ EXPECT_EQ_RECT(expectedProjection, projection);
+ EXPECT_EQ_SIZE(expectedRevisedSize, revisedSize);
+
+ // Portrait resize to 100x100 and aligned to top
+ originalSize = CGSizeMake(200, 400);
+ targetSize = CGSizeMake(100, 100);
+ expectedRevisedSize = targetSize;
+ expectedProjection = CGRectMake(0, 0, 100, 200);
+ CalculateProjection(originalSize, targetSize,
+ ProjectionMode::kAspectFillAlignTop, revisedSize,
+ projection);
+ EXPECT_EQ_RECT(expectedProjection, projection);
+ EXPECT_EQ_SIZE(expectedRevisedSize, revisedSize);
+}
+
TEST(UIUtilTest, TestProjectionAspectFillNoClipping) {
CGSize originalSize, targetSize, expectedRevisedSize, revisedSize;
CGRect expectedProjection, projection;
« no previous file with comments | « ios/chrome/browser/ui/ui_util.mm ('k') | ios/chrome/browser/ui/uikit_ui_util_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698