Back to index

unity  6.0.0
test_indicator_appmenu.cpp
Go to the documentation of this file.
00001 // -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
00002 /*
00003  * Copyright (C) 2012 Canonical Ltd
00004  *
00005  * This program is free software: you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License version 3 as
00007  * published by the Free Software Foundation.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016  *
00017  * Authored by: Marco Trevisan (TreviƱo) <3v1n0@ubuntu.com>
00018  */
00019 
00020 #include <UnityCore/AppmenuIndicator.h>
00021 
00022 #include <gtest/gtest.h>
00023 
00024 using namespace std;
00025 using namespace unity;
00026 using namespace indicator;
00027 
00028 namespace
00029 {
00030 
00031 TEST(TestAppmenuIndicator, Construction)
00032 {
00033   AppmenuIndicator indicator("indicator-appmenu");
00034 
00035   EXPECT_EQ(indicator.name(), "indicator-appmenu");
00036   EXPECT_TRUE(indicator.IsAppmenu());
00037 }
00038 
00039 TEST(TestAppmenuIndicator, ShowAppmenu)
00040 {
00041   AppmenuIndicator indicator("indicator-appmenu");
00042 
00043   bool signal_emitted = false;
00044   int show_x, show_y;
00045   unsigned int show_xid, show_timestamp;
00046 
00047   // Connecting to signals
00048   indicator.on_show_appmenu.connect([&] (unsigned int xid, int x, int y,
00049                                          unsigned int timestamp) {
00050     signal_emitted = true;
00051     show_xid = xid;
00052     show_x = x;
00053     show_y = y;
00054     show_timestamp = timestamp;
00055   });
00056 
00057   indicator.ShowAppmenu(123456789, 50, 100, 1328308554);
00058   EXPECT_TRUE(signal_emitted);
00059 
00060   EXPECT_EQ(show_xid, 123456789);
00061   EXPECT_EQ(show_x, 50);
00062   EXPECT_EQ(show_y, 100);
00063   EXPECT_EQ(show_timestamp, 1328308554);
00064 }
00065 
00066 }