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

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

Issue 10828265: Replace views::LocatedEvent with ui::LocatedEvent (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/views/view.cc ('k') | ui/views/widget/drop_helper.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 923 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 } 934 }
935 935
936 private: 936 private:
937 bool has_hittest_mask_; 937 bool has_hittest_mask_;
938 938
939 DISALLOW_COPY_AND_ASSIGN(HitTestView); 939 DISALLOW_COPY_AND_ASSIGN(HitTestView);
940 }; 940 };
941 941
942 gfx::Point ConvertPointToView(View* view, const gfx::Point& p) { 942 gfx::Point ConvertPointToView(View* view, const gfx::Point& p) {
943 gfx::Point tmp(p); 943 gfx::Point tmp(p);
944 View::ConvertPointToView(view->GetWidget()->GetRootView(), view, &tmp); 944 View::ConvertPointToTarget(view->GetWidget()->GetRootView(), view, &tmp);
945 return tmp; 945 return tmp;
946 } 946 }
947 947
948 gfx::Rect ConvertRectToView(View* view, const gfx::Rect& r) { 948 gfx::Rect ConvertRectToView(View* view, const gfx::Rect& r) {
949 gfx::Rect tmp(r); 949 gfx::Rect tmp(r);
950 tmp.set_origin(ConvertPointToView(view, r.origin())); 950 tmp.set_origin(ConvertPointToView(view, r.origin()));
951 return tmp; 951 return tmp;
952 } 952 }
953 953
954 void RotateCounterclockwise(ui::Transform* transform) { 954 void RotateCounterclockwise(ui::Transform* transform) {
(...skipping 1409 matching lines...) Expand 10 before | Expand all | Expand 10 after
2364 EXPECT_EQ(-55, matrix.getTranslateY()); 2364 EXPECT_EQ(-55, matrix.getTranslateY());
2365 EXPECT_EQ(100, matrix.getScaleX()); 2365 EXPECT_EQ(100, matrix.getScaleX());
2366 EXPECT_EQ(55, matrix.getScaleY()); 2366 EXPECT_EQ(55, matrix.getScaleY());
2367 EXPECT_EQ(0, matrix.getSkewX()); 2367 EXPECT_EQ(0, matrix.getSkewX());
2368 EXPECT_EQ(0, matrix.getSkewY()); 2368 EXPECT_EQ(0, matrix.getSkewY());
2369 } 2369 }
2370 2370
2371 // Conversions from child->top and top->child. 2371 // Conversions from child->top and top->child.
2372 { 2372 {
2373 gfx::Point point(5, 5); 2373 gfx::Point point(5, 5);
2374 View::ConvertPointToView(child, &top_view, &point); 2374 View::ConvertPointToTarget(child, &top_view, &point);
2375 EXPECT_EQ(22, point.x()); 2375 EXPECT_EQ(22, point.x());
2376 EXPECT_EQ(39, point.y()); 2376 EXPECT_EQ(39, point.y());
2377 2377
2378 point.SetPoint(22, 39); 2378 point.SetPoint(22, 39);
2379 View::ConvertPointToView(&top_view, child, &point); 2379 View::ConvertPointToTarget(&top_view, child, &point);
2380 EXPECT_EQ(5, point.x()); 2380 EXPECT_EQ(5, point.x());
2381 EXPECT_EQ(5, point.y()); 2381 EXPECT_EQ(5, point.y());
2382 } 2382 }
2383 2383
2384 // Conversions from child_child->top and top->child_child. 2384 // Conversions from child_child->top and top->child_child.
2385 { 2385 {
2386 gfx::Point point(5, 5); 2386 gfx::Point point(5, 5);
2387 View::ConvertPointToView(child_child, &top_view, &point); 2387 View::ConvertPointToTarget(child_child, &top_view, &point);
2388 EXPECT_EQ(133, point.x()); 2388 EXPECT_EQ(133, point.x());
2389 EXPECT_EQ(211, point.y()); 2389 EXPECT_EQ(211, point.y());
2390 2390
2391 point.SetPoint(133, 211); 2391 point.SetPoint(133, 211);
2392 View::ConvertPointToView(&top_view, child_child, &point); 2392 View::ConvertPointToTarget(&top_view, child_child, &point);
2393 EXPECT_EQ(5, point.x()); 2393 EXPECT_EQ(5, point.x());
2394 EXPECT_EQ(5, point.y()); 2394 EXPECT_EQ(5, point.y());
2395 } 2395 }
2396 2396
2397 // Conversions from child_child->child and child->child_child 2397 // Conversions from child_child->child and child->child_child
2398 { 2398 {
2399 gfx::Point point(5, 5); 2399 gfx::Point point(5, 5);
2400 View::ConvertPointToView(child_child, child, &point); 2400 View::ConvertPointToTarget(child_child, child, &point);
2401 EXPECT_EQ(42, point.x()); 2401 EXPECT_EQ(42, point.x());
2402 EXPECT_EQ(48, point.y()); 2402 EXPECT_EQ(48, point.y());
2403 2403
2404 point.SetPoint(42, 48); 2404 point.SetPoint(42, 48);
2405 View::ConvertPointToView(child, child_child, &point); 2405 View::ConvertPointToTarget(child, child_child, &point);
2406 EXPECT_EQ(5, point.x()); 2406 EXPECT_EQ(5, point.x());
2407 EXPECT_EQ(5, point.y()); 2407 EXPECT_EQ(5, point.y());
2408 } 2408 }
2409 2409
2410 // Conversions from top_view to child with a value that should be negative. 2410 // Conversions from top_view to child with a value that should be negative.
2411 // This ensures we don't round up with negative numbers. 2411 // This ensures we don't round up with negative numbers.
2412 { 2412 {
2413 gfx::Point point(6, 18); 2413 gfx::Point point(6, 18);
2414 View::ConvertPointToView(&top_view, child, &point); 2414 View::ConvertPointToTarget(&top_view, child, &point);
2415 EXPECT_EQ(-1, point.x()); 2415 EXPECT_EQ(-1, point.x());
2416 EXPECT_EQ(-1, point.y()); 2416 EXPECT_EQ(-1, point.y());
2417 } 2417 }
2418 } 2418 }
2419 2419
2420 // Tests conversion methods for rectangles. 2420 // Tests conversion methods for rectangles.
2421 TEST_F(ViewTest, ConvertRectWithTransform) { 2421 TEST_F(ViewTest, ConvertRectWithTransform) {
2422 scoped_ptr<Widget> widget(new Widget); 2422 scoped_ptr<Widget> widget(new Widget);
2423 Widget::InitParams params(Widget::InitParams::TYPE_POPUP); 2423 Widget::InitParams params(Widget::InitParams::TYPE_POPUP);
2424 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 2424 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
(...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after
3361 // Set to non default value. 3361 // Set to non default value.
3362 v->layer()->set_scale_content(false); 3362 v->layer()->set_scale_content(false);
3363 scoped_ptr<ui::Layer> old_layer(v->RecreateLayer()); 3363 scoped_ptr<ui::Layer> old_layer(v->RecreateLayer());
3364 ui::Layer* new_layer = v->layer(); 3364 ui::Layer* new_layer = v->layer();
3365 EXPECT_FALSE(new_layer->scale_content()); 3365 EXPECT_FALSE(new_layer->scale_content());
3366 } 3366 }
3367 3367
3368 #endif // USE_AURA 3368 #endif // USE_AURA
3369 3369
3370 } // namespace views 3370 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/view.cc ('k') | ui/views/widget/drop_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698