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

Side by Side Diff: ui/views/view_unittest.cc

Issue 11359172: ui: Remove implicit flooring in skia rect conversion methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make root window transform in tests produce an integer result Created 8 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 | Annotate | Revision Log
« no previous file with comments | « ui/views/view.cc ('k') | ui/views/widget/widget.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <map> 5 #include <map>
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/rand_util.h" 8 #include "base/rand_util.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 2465 matching lines...) Expand 10 before | Expand all | Expand 10 after
2476 2476
2477 // Scale down |v1| 2477 // Scale down |v1|
2478 gfx::Transform t1; 2478 gfx::Transform t1;
2479 t1.SetScale(0.5, 0.5); 2479 t1.SetScale(0.5, 0.5);
2480 v1->SetTransform(t1); 2480 v1->SetTransform(t1);
2481 2481
2482 // The rectangle should remain the same for |v1|. 2482 // The rectangle should remain the same for |v1|.
2483 EXPECT_EQ(gfx::Rect(25, 100, 40, 15), v2->ConvertRectToParent(rect)); 2483 EXPECT_EQ(gfx::Rect(25, 100, 40, 15), v2->ConvertRectToParent(rect));
2484 2484
2485 // |v2| now occupies (20, 20) to (120, 70) in |widget| 2485 // |v2| now occupies (20, 20) to (120, 70) in |widget|
2486 // There are some rounding of floating values here. These values may change if 2486 EXPECT_EQ(gfx::Rect(22, 60, 21, 8).ToString(),
2487 // floating operations are improved/changed. 2487 v2->ConvertRectToWidget(rect).ToString());
2488 EXPECT_EQ(gfx::Rect(22, 60, 20, 7), v2->ConvertRectToWidget(rect));
2489 2488
2490 widget->CloseNow(); 2489 widget->CloseNow();
2491 } 2490 }
2492 2491
2493 class ObserverView : public View { 2492 class ObserverView : public View {
2494 public: 2493 public:
2495 ObserverView(); 2494 ObserverView();
2496 virtual ~ObserverView(); 2495 virtual ~ObserverView();
2497 2496
2498 void ResetTestState(); 2497 void ResetTestState();
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after
3387 // Set to non default value. 3386 // Set to non default value.
3388 v->layer()->set_scale_content(false); 3387 v->layer()->set_scale_content(false);
3389 scoped_ptr<ui::Layer> old_layer(v->RecreateLayer()); 3388 scoped_ptr<ui::Layer> old_layer(v->RecreateLayer());
3390 ui::Layer* new_layer = v->layer(); 3389 ui::Layer* new_layer = v->layer();
3391 EXPECT_FALSE(new_layer->scale_content()); 3390 EXPECT_FALSE(new_layer->scale_content());
3392 } 3391 }
3393 3392
3394 #endif // USE_AURA 3393 #endif // USE_AURA
3395 3394
3396 } // namespace views 3395 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/view.cc ('k') | ui/views/widget/widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698