indicator-location-13.10.0+14.04.20140207/ 0000755 0000152 0177776 00000000000 12275205574 020043 5 ustar pbuser nogroup 0000000 0000000 indicator-location-13.10.0+14.04.20140207/ChangeLog 0000644 0000152 0177776 00000000046 12275205355 021612 0 ustar pbuser nogroup 0000000 0000000 # Generated by Makefile. Do not edit.
indicator-location-13.10.0+14.04.20140207/cmake/ 0000755 0000152 0177776 00000000000 12275205574 021123 5 ustar pbuser nogroup 0000000 0000000 indicator-location-13.10.0+14.04.20140207/cmake/GCov.cmake 0000644 0000152 0177776 00000005301 12275205355 022757 0 ustar pbuser nogroup 0000000 0000000 if (CMAKE_BUILD_TYPE MATCHES coverage)
set(LCOV_RAW_FILE "lcov-raw.info")
set(LCOV_FILE "lcov.info")
set(GCOV_FLAGS "${GCOV_FLAGS} --coverage")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GCOV_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${GCOV_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${GCOV_FLAGS}")
set(GCOV_LIBS ${GCOV_LIBS} gcov)
find_program(GCOVR_EXECUTABLE gcovr HINTS ${GCOVR_ROOT} "${GCOVR_ROOT}/bin")
if (NOT GCOVR_EXECUTABLE)
message(STATUS "Gcovr binary was not found, can not generate XML coverage info.")
else ()
message(STATUS "Gcovr found, can generate XML coverage info.")
add_custom_target (coverage-xml
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND "${GCOVR_EXECUTABLE}" --exclude="test.*" -x -r "${CMAKE_SOURCE_DIR}"
--object-directory=${CMAKE_BINARY_DIR} -o coverage.xml)
endif()
find_program(LCOV_EXECUTABLE lcov HINTS ${LCOV_ROOT} "${GCOVR_ROOT}/bin")
find_program(GENHTML_EXECUTABLE genhtml HINTS ${GENHTML_ROOT})
if (NOT LCOV_EXECUTABLE)
message(STATUS "Lcov binary was not found, can not generate HTML coverage info.")
else ()
if(NOT GENHTML_EXECUTABLE)
message(STATUS "Genthml binary not found, can not generate HTML coverage info.")
else()
message(STATUS "Lcov and genhtml found, can generate HTML coverage info.")
add_custom_target (coverage-html
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND "${CMAKE_CTEST_COMMAND}" --force-new-ctest-process --verbose
# generate the raw lcov data
COMMAND "${LCOV_EXECUTABLE}" --directory ${CMAKE_BINARY_DIR} --capture -o ${LCOV_RAW_FILE}
# FIXME: when ubuntu gets lcov 1.10 we can use --no-external instead of the brittle --remove
COMMAND "${LCOV_EXECUTABLE}" --remove ${LCOV_RAW_FILE} "/usr/include/*" | ${CMAKE_SOURCE_DIR}/trim-lcov.py > ${LCOV_FILE}
COMMAND LANG=C "${GENHTML_EXECUTABLE}" --prefix ${CMAKE_BINARY_DIR} --output-directory lcov-html --legend --show-details ${LCOV_FILE}
COMMAND ${CMAKE_COMMAND} -E echo ""
COMMAND ${CMAKE_COMMAND} -E echo "file://${CMAKE_BINARY_DIR}/lcov-html/index.html"
COMMAND ${CMAKE_COMMAND} -E echo ""
VERBATIM) # VERBATIM is necessary here for the wildcard in --remove... again, when we go to lcov 1.10 we can drop this
#)
endif()
endif()
endif()
#$(MAKE) $(AM_MAKEFLAGS) check
#lcov --directory $(top_builddir) --capture --test-name dconf | $(top_srcdir)/trim-lcov.py > dconf-lcov.info
#LANG=C genhtml --prefix $(top_builddir) --output-directory lcov-html --legend --show-details dconf-lcov.info
#@echo
#@echo " file://$(abs_top_builddir)/lcov-html/index.html"
#@echo
indicator-location-13.10.0+14.04.20140207/cmake/Translations.cmake 0000644 0000152 0177776 00000003136 12275205355 024606 0 ustar pbuser nogroup 0000000 0000000 # Translations.cmake, CMake macros written for Marlin, feel free to re-use them
macro(add_translations_directory NLS_PACKAGE)
add_custom_target (i18n ALL)
find_program (MSGFMT_EXECUTABLE msgfmt)
file (GLOB PO_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.po)
foreach (PO_INPUT ${PO_FILES})
get_filename_component (PO_INPUT_BASE ${PO_INPUT} NAME_WE)
set (MO_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${PO_INPUT_BASE}.mo)
add_custom_command (TARGET i18n COMMAND ${MSGFMT_EXECUTABLE} -o ${MO_OUTPUT} ${PO_INPUT})
install (FILES ${MO_OUTPUT} DESTINATION
${CMAKE_INSTALL_LOCALEDIR}/LC_MESSAGES
RENAME ${NLS_PACKAGE}.mo)
endforeach (PO_INPUT ${PO_FILES})
endmacro(add_translations_directory)
macro(add_translations_catalog NLS_PACKAGE)
add_custom_target (pot COMMENT “Building translation catalog.”)
find_program (XGETTEXT_EXECUTABLE xgettext)
set(C_SOURCE "")
foreach(FILES_INPUT ${ARGN})
file (GLOB_RECURSE SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/${FILES_INPUT}/*.c)
foreach(C_FILE ${SOURCE_FILES})
set(C_SOURCE ${C_SOURCE} ${C_FILE})
endforeach()
file (GLOB_RECURSE SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/${FILES_INPUT}/*.vala)
foreach(C_FILE ${SOURCE_FILES})
set(C_SOURCE ${C_SOURCE} ${C_FILE})
endforeach()
endforeach()
add_custom_command (TARGET pot COMMAND
${XGETTEXT_EXECUTABLE} -d ${NLS_PACKAGE} -o ${CMAKE_CURRENT_SOURCE_DIR}/${NLS_PACKAGE}.pot
${VALA_SOURCE} ${C_SOURCE} --keyword="_" --keyword="N_" --from-code=UTF-8
)
endmacro()
indicator-location-13.10.0+14.04.20140207/tests/ 0000755 0000152 0177776 00000000000 12275205574 021205 5 ustar pbuser nogroup 0000000 0000000 indicator-location-13.10.0+14.04.20140207/tests/CMakeLists.txt 0000644 0000152 0177776 00000001411 12275205355 023737 0 ustar pbuser nogroup 0000000 0000000 ###
### Google Test Framework
###
add_library (gtest STATIC
${GTEST_SOURCE_DIR}/gtest-all.cc
${GTEST_SOURCE_DIR}/gtest_main.cc)
###
### phone-test
###
set (PHONE_TEST "phone-test")
add_executable (${PHONE_TEST} phone-test.cc)
add_test (${PHONE_TEST} ${PHONE_TEST})
###
### globals
###
set (ALL_TESTS ${PHONE_TEST})
set_property (TARGET ${ALL_TESTS}
APPEND_STRING PROPERTY COMPILE_FLAGS "${CC_WARNING_ARGS} -g --std=c++11")
set_property (TARGET ${ALL_TESTS}
APPEND PROPERTY LINK_LIBRARIES libindicator-location-service gtest ${GTEST_LIBS} ${GCOV_LIBS})
set_property (TARGET ${ALL_TESTS} gtest
APPEND PROPERTY INCLUDE_DIRECTORIES ${CMAKE_SOURCE_DIR} ${SERVICE_INCLUDE_DIRS} ${GTEST_INCLUDE_DIR})
indicator-location-13.10.0+14.04.20140207/tests/manual 0000644 0000152 0177776 00000001431 12275205355 022401 0 ustar pbuser nogroup 0000000 0000000
Test-case indicator-location/unity7-items-check
- Log in to a Unity 7 user session
- Go to the panel and click on the Location indicator
- Ensure there are items in the menu
Test-case indicator-location/unity7-greeter-items-check
- Start a system and wait for the greeter or logout of the current user session
- Go to the panel and click on the Location indicator
- Ensure there are items in the menu
Test-case indicator-location/unity8-items-check
- Login to a user session running Unity 8
- Pull down the top panel until it sticks open
- Navigate through the tabs until "Location" is shown
- Location is at the top of the menu
- The menu is populated with items
indicator-location-13.10.0+14.04.20140207/tests/phone-test.cc 0000644 0000152 0177776 00000013427 12275205355 023606 0 ustar pbuser nogroup 0000000 0000000 /*
* Copyright 2013 Canonical Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see .
*
* Authors:
* Charles Kerr
*/
#define INDICATOR_BUS_NAME "com.canonical.indicator.location"
#define INDICATOR_OBJECT_PATH "/com/canonical/indicator/location"
#define INDICATOR_PROFILE "phone"
#include "gtest-dbus-indicator-fixture.h"
#include "src/controller-mock.h"
#include "src/service.h"
class PhoneTest: public GTestDBusIndicatorFixture,
public ControllerListener
{
protected:
bool loc_enabled;
bool loc_enabled_changed;
bool gps_enabled;
bool gps_enabled_changed;
std::shared_ptr myController;
std::shared_ptr myService;
public:
void clear_callbacks ()
{
gps_enabled = false;
gps_enabled_changed = false;
gps_enabled = false;
loc_enabled_changed = false;
}
virtual void on_gps_enabled_changed (bool is_enabled)
{
gps_enabled_changed = true;
gps_enabled = is_enabled;
}
virtual void on_location_service_enabled_changed (bool is_enabled)
{
loc_enabled_changed = true;
loc_enabled = is_enabled;
}
protected:
virtual void SetUp ()
{
GTestDBusIndicatorFixture :: SetUp ();
clear_callbacks ();
}
virtual void setup_service ()
{
myController.reset (new MockController ());
myController->add_listener (this);
myService.reset (new Service (myController));
}
virtual void teardown_service ()
{
myService.reset ();
myController->remove_listener (this);
myController.reset ();
}
};
TEST_F (PhoneTest, ActionsExit)
{
ASSERT_TRUE (action_exists ("gps-detection-enabled"));
ASSERT_TRUE (action_exists ("location-detection-enabled"));
ASSERT_TRUE (action_exists ("phone-header"));
ASSERT_TRUE (action_exists ("settings"));
}
TEST_F (PhoneTest, MenuitemsExist)
{
ASSERT_TRUE (action_menuitem_exists ("indicator.location-detection-enabled"));
ASSERT_TRUE (action_menuitem_exists ("indicator.gps-detection-enabled"));
//ASSERT_TRUE (action_menuitem_exists ("indicator.settings"));
}
TEST_F (PhoneTest, PlatformTogglesGPS)
{
bool enabled;
const char * const key = "gps-detection-enabled";
GActionGroup * ag = G_ACTION_GROUP (action_group);
GVariant * v;
// check that the current state is the default value of 'false'
v = g_action_group_get_action_state (ag, key);
ASSERT_TRUE (v != nullptr);
enabled = g_variant_get_boolean (v);
g_variant_unref (v);
ASSERT_FALSE (enabled);
// confirm that toggling the mock controller's GPS is reflected in the action state
for (int i=0; i<4; i++)
{
enabled = !enabled;
myController->set_gps_enabled (enabled);
wait_for_action_state_change (key);
v = g_action_group_get_action_state (ag, key);
ASSERT_TRUE (v != nullptr);
ASSERT_EQ (enabled, g_variant_get_boolean (v));
g_variant_unref (v);
}
}
TEST_F (PhoneTest, UserTogglesGPS)
{
bool enabled;
const char * const key = "gps-detection-enabled";
GActionGroup * ag = G_ACTION_GROUP (action_group);
GVariant * v;
// check that the current state is the default value of 'false'
v = g_action_group_get_action_state (ag, key);
ASSERT_TRUE (v != nullptr);
enabled = g_variant_get_boolean (v);
g_variant_unref (v);
ASSERT_FALSE (enabled);
// confirm that toggling menu updates the controller
for (int i=0; i<4; i++)
{
clear_callbacks ();
g_action_group_activate_action (ag, key, nullptr);
while (!gps_enabled_changed)
wait_msec (50);
ASSERT_TRUE (gps_enabled_changed);
enabled = !enabled;
ASSERT_EQ (enabled, gps_enabled);
}
}
TEST_F (PhoneTest, PlatformTogglesLocation)
{
bool enabled;
const char * const key = "location-detection-enabled";
GActionGroup * ag = G_ACTION_GROUP (action_group);
GVariant * v;
// check that the current state is the default value of 'false'
v = g_action_group_get_action_state (ag, key);
ASSERT_TRUE (v != nullptr);
enabled = g_variant_get_boolean (v);
g_variant_unref (v);
ASSERT_FALSE (enabled);
// confirm that toggling the mock controller's GPS is reflected in the action state
for (int i=0; i<4; i++)
{
enabled = !enabled;
myController->set_location_service_enabled (enabled);
wait_for_action_state_change (key);
v = g_action_group_get_action_state (ag, key);
ASSERT_TRUE (v != nullptr);
ASSERT_EQ (enabled, g_variant_get_boolean (v));
g_variant_unref (v);
}
}
TEST_F (PhoneTest, UserTogglesLocation)
{
bool enabled;
const char * const key = "location-detection-enabled";
GActionGroup * ag = G_ACTION_GROUP (action_group);
GVariant * v;
// check that the current state is the default value of 'false'
v = g_action_group_get_action_state (ag, key);
ASSERT_TRUE (v != nullptr);
enabled = g_variant_get_boolean (v);
g_variant_unref (v);
ASSERT_FALSE (enabled);
// confirm that toggling menu updates the controller
for (int i=0; i<4; i++)
{
clear_callbacks ();
g_action_group_activate_action (ag, key, nullptr);
while (!loc_enabled_changed)
wait_msec (50);
ASSERT_TRUE (loc_enabled_changed);
enabled = !enabled;
ASSERT_EQ (enabled, loc_enabled);
}
}
indicator-location-13.10.0+14.04.20140207/tests/gtest-dbus-indicator-fixture.h 0000644 0000152 0177776 00000021151 12275205355 027072 0 ustar pbuser nogroup 0000000 0000000 /*
* Copyright 2013 Canonical Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see .
*
* Authors:
* Charles Kerr
*/
#include "gtest-dbus-fixture.h"
class GTestDBusIndicatorFixture: public GTestDBusFixture
{
typedef GTestDBusFixture super;
enum { TIME_LIMIT_SEC = 10 };
private:
static void on_name_appeared (GDBusConnection * connection G_GNUC_UNUSED,
const gchar * name G_GNUC_UNUSED,
const gchar * name_owner G_GNUC_UNUSED,
gpointer gself)
{
g_main_loop_quit (static_cast(gself)->loop);
}
GSList * menu_references;
gboolean any_item_changed;
static void on_items_changed (GMenuModel * model G_GNUC_UNUSED,
gint position G_GNUC_UNUSED,
gint removed G_GNUC_UNUSED,
gint added G_GNUC_UNUSED,
gpointer any_item_changed)
{
*((gboolean*)any_item_changed) = true;
}
protected:
void activate_subtree (GMenuModel * model)
{
// query the GDBusMenuModel for information to activate it
int n = g_menu_model_get_n_items (model);
if (!n)
{
// give the model a moment to populate its info
wait_msec (100);
n = g_menu_model_get_n_items (model);
}
// keep a ref so that it stays activated
menu_references = g_slist_prepend (menu_references, g_object_ref(model));
g_signal_connect (model, "items-changed", G_CALLBACK(on_items_changed), &any_item_changed);
// recurse
for (int i=0; i= TIME_LIMIT_SEC;
}
protected:
void wait_for_has_action (const char * name)
{
while (!g_action_group_has_action (G_ACTION_GROUP(action_group), name) && !times_up())
wait_msec (50);
ASSERT_FALSE (times_up());
ASSERT_TRUE (g_action_group_has_action (G_ACTION_GROUP(action_group), name));
}
void wait_for_menu_resync (void)
{
any_item_changed = false;
while (!times_up() && !any_item_changed)
wait_msec (50);
g_warn_if_fail (any_item_changed);
sync_menu ();
}
void wait_for_action_state_change (const gchar * action_name)
{
gchar * signal_name = g_strdup_printf ("action-state-changed::%s", action_name);
wait_for_signal (action_group, signal_name);
g_free (signal_name);
}
protected:
bool find_menu_item_for_action (const char * action_key, GMenuModel ** setme, int * item_index)
{
bool success = false;
for (GSList * l=menu_references; !success && (l!=nullptr); l=l->next)
{
GMenuModel * mm = G_MENU_MODEL (l->data);
const int n = g_menu_model_get_n_items (mm);
for (int i=0; !success && i