~didrocks/libunity/bootstrap

« back to all changes in this revision

Viewing changes to test/vala/test-launcher-integration.vala

  • Committer: Tarmac
  • Author(s): Michal Hruby
  • Date: 2012-10-05 11:24:10 UTC
  • mfrom: (184.1.1 libunity)
  • Revision ID: tarmac-20121005112410-w73p7leppxelov3x
Check for existence of schemas which we don't ship. Fixes: https://bugs.launchpad.net/bugs/973518, https://bugs.launchpad.net/bugs/1062099. Approved by Pawel Stolowski.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
 
26
26
public class Main
27
27
{
 
28
  public const string LAUNCHER_SCHEMA_NAME = "com.canonical.Unity.Launcher";
 
29
 
 
30
  public static bool schema_exists (string schema)
 
31
  {
 
32
    unowned string[] installed_schemas = Settings.list_schemas ();
 
33
    return schema in installed_schemas;
 
34
  }
 
35
 
28
36
  public static int main (string[] args)
29
37
  {
30
38
    /* Prepend test search path for XDG_DATA_DIRS so we can find
38
46
    
39
47
    /* Make sure we don't hose the user env with our tests... */
40
48
    Environment.set_variable ("GSETTINGS_BACKEND", "memory", true);
41
 
    
 
49
 
 
50
    if (!schema_exists (LAUNCHER_SCHEMA_NAME))
 
51
    {
 
52
      warning ("Schema \"%s\" is not installed, skipping LauncherFavorites tests", LAUNCHER_SCHEMA_NAME);
 
53
      return 0;
 
54
    }
 
55
 
42
56
    Test.init (ref args);
43
57
 
44
58
    Test.add_data_func ("/Integration/Launcher/Favorites/UnknownApps",
66
80
  
67
81
  internal static void set_up () {  
68
82
    assert ("memory" == Environment.get_variable ("GSETTINGS_BACKEND"));
69
 
    var settings = new Settings ("com.canonical.Unity.Launcher");
 
83
    var settings = new Settings (LAUNCHER_SCHEMA_NAME);
70
84
    
71
85
    string[] faves = { "rhythmbox.desktop", "file://testapp1.desktop",
72
86
                       "application://ubuntu-about.desktop",
159
173
    });
160
174
    
161
175
    /* Change the faves */
162
 
    var settings = new Settings ("com.canonical.Unity.Launcher");
 
176
    var settings = new Settings (LAUNCHER_SCHEMA_NAME);
163
177
    string[] new_faves = { "rhythmbox.desktop" };
164
178
    settings.set_strv ("favorites", new_faves);
165
179