This source file includes following definitions.
- time_view
- horizontal_label
- vertical_label_hours
- vertical_label_minutes
- CreateTimeView
- TEST_F
#include "ash/system/date/date_view.h"
#include "ash/test/ash_test_base.h"
#include "ui/views/controls/label.h"
namespace ash {
namespace tray {
class TimeViewTest : public ash::test::AshTestBase {
public:
TimeViewTest() {}
virtual ~TimeViewTest() {}
TimeView* time_view() { return time_view_.get(); }
views::Label* horizontal_label() {
return time_view_->horizontal_label_.get();
}
views::Label* vertical_label_hours() {
return time_view_->vertical_label_hours_.get();
}
views::Label* vertical_label_minutes() {
return time_view_->vertical_label_minutes_.get();
}
void CreateTimeView(TrayDate::ClockLayout clock_layout) {
time_view_.reset(new TimeView(clock_layout));
}
private:
scoped_ptr<TimeView> time_view_;
DISALLOW_COPY_AND_ASSIGN(TimeViewTest);
};
TEST_F(TimeViewTest, Basics) {
CreateTimeView(TrayDate::HORIZONTAL_CLOCK);
EXPECT_EQ(time_view(), horizontal_label()->parent());
EXPECT_FALSE(vertical_label_hours()->parent());
EXPECT_FALSE(vertical_label_minutes()->parent());
time_view()->UpdateClockLayout(TrayDate::VERTICAL_CLOCK);
EXPECT_FALSE(horizontal_label()->parent());
EXPECT_EQ(time_view(), vertical_label_hours()->parent());
EXPECT_EQ(time_view(), vertical_label_minutes()->parent());
time_view()->UpdateClockLayout(TrayDate::HORIZONTAL_CLOCK);
EXPECT_EQ(time_view(), horizontal_label()->parent());
EXPECT_FALSE(vertical_label_hours()->parent());
EXPECT_FALSE(vertical_label_minutes()->parent());
}
}
}