OLD | NEW |
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 "ui/aura/window.h" | 5 #include "ui/aura/window.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1898 // Make sure that properties which should persist from the old layer to the new | 1898 // Make sure that properties which should persist from the old layer to the new |
1899 // layer actually do. | 1899 // layer actually do. |
1900 TEST_F(WindowTest, RecreateLayer) { | 1900 TEST_F(WindowTest, RecreateLayer) { |
1901 // Set properties to non default values. | 1901 // Set properties to non default values. |
1902 Window w(new ColorTestWindowDelegate(SK_ColorWHITE)); | 1902 Window w(new ColorTestWindowDelegate(SK_ColorWHITE)); |
1903 w.set_id(1); | 1903 w.set_id(1); |
1904 w.Init(aura::WINDOW_LAYER_SOLID_COLOR); | 1904 w.Init(aura::WINDOW_LAYER_SOLID_COLOR); |
1905 w.SetBounds(gfx::Rect(0, 0, 100, 100)); | 1905 w.SetBounds(gfx::Rect(0, 0, 100, 100)); |
1906 | 1906 |
1907 ui::Layer* layer = w.layer(); | 1907 ui::Layer* layer = w.layer(); |
1908 layer->set_scale_content(false); | |
1909 layer->SetVisible(false); | 1908 layer->SetVisible(false); |
1910 layer->SetMasksToBounds(true); | 1909 layer->SetMasksToBounds(true); |
1911 | 1910 |
1912 ui::Layer child_layer; | 1911 ui::Layer child_layer; |
1913 layer->Add(&child_layer); | 1912 layer->Add(&child_layer); |
1914 | 1913 |
1915 scoped_ptr<ui::Layer> old_layer(w.RecreateLayer()); | 1914 scoped_ptr<ui::Layer> old_layer(w.RecreateLayer()); |
1916 layer = w.layer(); | 1915 layer = w.layer(); |
1917 EXPECT_EQ(ui::LAYER_SOLID_COLOR, layer->type()); | 1916 EXPECT_EQ(ui::LAYER_SOLID_COLOR, layer->type()); |
1918 EXPECT_FALSE(layer->scale_content()); | |
1919 EXPECT_FALSE(layer->visible()); | 1917 EXPECT_FALSE(layer->visible()); |
1920 EXPECT_EQ(1u, layer->children().size()); | 1918 EXPECT_EQ(1u, layer->children().size()); |
1921 EXPECT_TRUE(layer->GetMasksToBounds()); | 1919 EXPECT_TRUE(layer->GetMasksToBounds()); |
1922 EXPECT_EQ("0,0 100x100", w.bounds().ToString()); | 1920 EXPECT_EQ("0,0 100x100", w.bounds().ToString()); |
1923 EXPECT_EQ("0,0 100x100", layer->bounds().ToString()); | 1921 EXPECT_EQ("0,0 100x100", layer->bounds().ToString()); |
1924 } | 1922 } |
1925 | 1923 |
1926 // Verify that RecreateLayer() stacks the old layer above the newly creatd | 1924 // Verify that RecreateLayer() stacks the old layer above the newly creatd |
1927 // layer. | 1925 // layer. |
1928 TEST_F(WindowTest, RecreateLayerZOrder) { | 1926 TEST_F(WindowTest, RecreateLayerZOrder) { |
(...skipping 1415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3344 BuildRootLayerTreeDescription(*root.layer())) | 3342 BuildRootLayerTreeDescription(*root.layer())) |
3345 << "layer tree doesn't match at " << i; | 3343 << "layer tree doesn't match at " << i; |
3346 EXPECT_EQ(data[i].expected_description, | 3344 EXPECT_EQ(data[i].expected_description, |
3347 BuildRootWindowTreeDescription(root)) | 3345 BuildRootWindowTreeDescription(root)) |
3348 << "window tree doesn't match at " << i; | 3346 << "window tree doesn't match at " << i; |
3349 } | 3347 } |
3350 } | 3348 } |
3351 | 3349 |
3352 } // namespace test | 3350 } // namespace test |
3353 } // namespace aura | 3351 } // namespace aura |
OLD | NEW |