~ubuntu-branches/ubuntu/oneiric/unity/oneiric

« back to all changes in this revision

Viewing changes to tests/test_filesystem_lenses.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2011-08-01 19:53:15 UTC
  • mfrom: (1.1.49 upstream)
  • Revision ID: james.westby@ubuntu.com-20110801195315-mrewa9g7ctnk41oh
Tags: 4.6.0-0ubuntu1
* New upstream release.
  - compiz crashed with SIGSEGV in __strlen_sse2() (LP: #814619)
  - PlacesHomeView::PlacesHomeView leaks memory (LP: #818450)
  - PluginAdapter::MaximizeIfBigEnough leaks memory (LP: #818477)
  - Launcher - Make Launcher left of screen reveal more responsive and less
    prone to false positives (LP: #765819)
  - Launcher - clicking on a App launcher icon incorrectly un-minimizes
    windows (LP: #783434)
  - Unity doesn't get any mouse wheel scroll event in Indicators InputArea
    (LP: #814574)
  - Unity launcher gets cluttered when having multiple partitions and/or
    external volumes attached (LP: #713423)
  - Unity panel menus and indicators slow to respond. Too much lag.
    (LP: #742664)
  - In Unity the distinction between GVolume, GDrive and GMount is a bit
    confusing. (LP: #799890)
  - Launcher - When a item is deleted by dragging to Trash, the trash should
    pulse once before the Launcher disappears (LP: #750311)
  - ccsm needs an option to change launcher opacity (LP: #815032)
  - add a ccsm option to hide volumes in launcher (LP: #794707)
  - scale plugin doesn't work as desired when "Click Desktop To Show
    Desktop" is true (LP: #810315)
  - mute/unmute sound when user clicks on sound applet using scroll button
    or middle mouse button (LP: #609860)
  - Secondary activate (i.e. middle click) support for indicators advanced
    usage (LP: #812933)
* debian/control:
  - dep on latest libunity-misc
  - dep on latest nux
  - add build-dep on libgnome-desktop-3-dev
* debian/rules:
  - bump libunity-core-4.0-4 shlib for ABI break
  - don't ship unity dialogs right now. Not ready for alpha quality
* distro-patch the grey to darker grey (until the blur is done in nux)
* Switch to dpkg-source 3.0 (quilt) format
* debian/patches/01_revert_removed_function_for_unity2d_to_build.patch:
  - revert a removed API making unity-2d not building

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <gtest/gtest.h>
 
2
#include <glib-object.h>
 
3
#include <UnityCore/FilesystemLenses.h>
 
4
 
 
5
using namespace std;
 
6
using namespace unity::dash;
 
7
 
 
8
namespace
 
9
{
 
10
 
 
11
void WaitForResult(bool& result)
 
12
{
 
13
  bool timeout_reached;
 
14
 
 
15
  auto timeout_cb = [](gpointer data) -> gboolean
 
16
  {
 
17
    *(bool*)data = true;
 
18
    return FALSE;
 
19
  };
 
20
 
 
21
  guint32 timeout_id = g_timeout_add_seconds(10, timeout_cb, &timeout_reached);
 
22
 
 
23
  while (!result && !timeout_reached)
 
24
  {
 
25
    g_main_context_iteration(g_main_context_get_thread_default(), TRUE);
 
26
  }
 
27
  if (result)
 
28
    g_source_remove(timeout_id);
 
29
}
 
30
 
 
31
void WaitForLensesToLoad(FilesystemLenses& lenses)
 
32
{
 
33
  bool result = false;
 
34
 
 
35
  auto lenses_loaded_cb = [&result]()
 
36
  {
 
37
    result = true;
 
38
  };
 
39
  lenses.lenses_loaded.connect(sigc::slot<void>(lenses_loaded_cb));
 
40
 
 
41
  WaitForResult(result);
 
42
  EXPECT_TRUE(result);
 
43
}
 
44
 
 
45
TEST(TestFilesystemLenses, TestConstruction)
 
46
{
 
47
  FilesystemLenses lenses0;
 
48
  FilesystemLenses lenses1(TESTDATADIR"/lenses");
 
49
}
 
50
 
 
51
TEST(TestFilesystemLenses, TestFileLoading)
 
52
{
 
53
  FilesystemLenses lenses(TESTDATADIR"/lenses");
 
54
  WaitForLensesToLoad(lenses);
 
55
}
 
56
 
 
57
TEST(TestFilesystemLenses, TestLensesAdded)
 
58
{
 
59
  FilesystemLenses lenses(TESTDATADIR"/lenses");
 
60
  int  n_lenses = 0;
 
61
 
 
62
  auto lens_added_cb = [&n_lenses](Lens::Ptr & p)
 
63
  {
 
64
    n_lenses++;
 
65
  };
 
66
  lenses.lens_added.connect(sigc::slot<void, Lens::Ptr&>(lens_added_cb));
 
67
 
 
68
  WaitForLensesToLoad(lenses);
 
69
  EXPECT_EQ(n_lenses, (unsigned int)3);
 
70
  EXPECT_EQ(lenses.count, (unsigned int)3);
 
71
}
 
72
 
 
73
TEST(TestFilesystemLenses, TestLensContent)
 
74
{
 
75
  FilesystemLenses lenses(TESTDATADIR"/lenses");
 
76
  WaitForLensesToLoad(lenses);
 
77
 
 
78
  // Test that the lenses have loaded correctly
 
79
  Lens::Ptr lens = lenses.GetLens("applications.lens");
 
80
  EXPECT_TRUE(lens.get());
 
81
  EXPECT_EQ(lens->dbus_name, "com.canonical.tests.Lens.Applications");
 
82
  EXPECT_EQ(lens->dbus_path, "/com/canonical/tests/lens/applications");
 
83
  EXPECT_EQ(lens->name, "Applications");
 
84
  EXPECT_EQ(lens->icon, "/usr/share/unity-lens-applications/applications.png");
 
85
  EXPECT_EQ(lens->description, "Search for applications");
 
86
  EXPECT_EQ(lens->search_hint, "Search Applications");
 
87
  EXPECT_EQ(lens->visible, true);
 
88
  EXPECT_EQ(lens->shortcut, "a");
 
89
 
 
90
  lens = lenses.GetLens("files.lens");
 
91
  EXPECT_TRUE(lens.get());
 
92
  EXPECT_EQ(lens->dbus_name, "com.canonical.tests.Lens.Files");
 
93
  EXPECT_EQ(lens->dbus_path, "/com/canonical/tests/lens/files");
 
94
  EXPECT_EQ(lens->name, "Files");
 
95
  EXPECT_EQ(lens->icon, "/usr/share/unity-lens-files/files.png");
 
96
  EXPECT_EQ(lens->description, "Search for Files & Folders");
 
97
  EXPECT_EQ(lens->search_hint, "Search Files & Folders");
 
98
  EXPECT_EQ(lens->visible, true);
 
99
  EXPECT_EQ(lens->shortcut, "f");
 
100
 
 
101
  lens = lenses.GetLens("social.lens");
 
102
  EXPECT_TRUE(lens.get());
 
103
  EXPECT_EQ(lens->dbus_name, "com.canonical.tests.Lens.Social");
 
104
  EXPECT_EQ(lens->dbus_path, "/com/canonical/tests/lens/social");
 
105
  EXPECT_EQ(lens->name, "Social");
 
106
  EXPECT_EQ(lens->icon, "/usr/share/unity-lens-social/social.png");
 
107
  EXPECT_EQ(lens->description, "");
 
108
  EXPECT_EQ(lens->search_hint, "");
 
109
  EXPECT_EQ(lens->visible, false);
 
110
  EXPECT_EQ(lens->shortcut, "");
 
111
}
 
112
 
 
113
}