~mhr3/libunity/fix-1062331

« back to all changes in this revision

Viewing changes to test/vala/test-lens.vala

  • Committer: Tarmac
  • Author(s): Pawel Stolowski
  • Date: 2012-08-29 12:10:08 UTC
  • mfrom: (167.1.7 libunity.private-content)
  • Revision ID: tarmac-20120829121008-81xpyyn1hiqebfhj
Implemented provides_private_content flag.. Fixes: . Approved by Michal Hruby.

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
    Test.add_data_func ("/Unit/Lens/Preview/Async", test_lens_preview_async);
59
59
    Test.add_data_func ("/Unit/Lens/Preview/Signal", test_lens_preview_signal);
60
60
    Test.add_data_func ("/Unit/Lens/Preview/ClosedSignal", test_lens_preview_closed_signal);
 
61
    Test.add_data_func ("/Unit/Lens/PrivateContentFlag", test_lens_private_content_flag);
61
62
 
62
63
    Test.run ();
63
64
 
193
194
    });
194
195
  }
195
196
 
 
197
  private static Unity.Protocol.LensInfo? get_lens_info ()
 
198
  {
 
199
    var ml = new MainLoop ();
 
200
    Unity.Protocol.LensInfo? info = null;
 
201
 
 
202
    try
 
203
    {
 
204
      var bus = Bus.get_sync (BusType.SESSION);
 
205
      var sig_id = bus.signal_subscribe (null,
 
206
                                         "com.canonical.Unity.Lens",
 
207
                                         "Changed",
 
208
                                         "/com/canonical/Unity/Lens/Test",
 
209
                                         null,
 
210
                                         0,
 
211
                                         (conn, sender, obj_path, ifc_name, sig_name, parameters) =>
 
212
      {
 
213
        info = (Unity.Protocol.LensInfo) parameters.get_child_value (0);
 
214
        ml.quit ();
 
215
      });
 
216
 
 
217
      call_lens_method ("InfoRequest", null, null);
 
218
 
 
219
      run_with_timeout (ml, 5000);
 
220
 
 
221
      bus.signal_unsubscribe (sig_id);
 
222
    }
 
223
    catch (Error e) {
 
224
      warning ("%s", e.message);
 
225
    }
 
226
 
 
227
    return info;
 
228
  }
 
229
 
196
230
  private static void call_lens_search (string search_string,
197
231
                                        Func<Variant?>? cb = null)
198
232
  {
1065
1099
 
1066
1100
    assert (got_closed_signal == 1);
1067
1101
  }
 
1102
 
 
1103
  public static void test_lens_private_content_flag ()
 
1104
  {
 
1105
    SignalWrapper[] signals = null;
 
1106
    assert (local_scope != null);
 
1107
    assert (exported_lens != null);
 
1108
 
 
1109
    // check default value of provides_private_content
 
1110
    Unity.Protocol.LensInfo? info = get_lens_info ();
 
1111
    assert (info != null);
 
1112
    assert (info.hints.contains ("provides-private-content"));
 
1113
    assert (info.hints["provides-private-content"].get_boolean () == false);
 
1114
 
 
1115
    local_scope.provides_private_content = true;
 
1116
 
 
1117
    info = get_lens_info ();
 
1118
    assert (info != null);
 
1119
    assert (info.hints.contains ("provides-private-content"));
 
1120
    assert (info.hints["provides-private-content"].get_boolean () == true);
 
1121
  }
 
1122
 
1068
1123
}