~alan-griffiths/miral/1.3

« back to all changes in this revision

Viewing changes to test/active_window.cpp

  • Committer: Bileto Bot
  • Date: 2017-03-16 18:17:19 UTC
  • mfrom: (356.1.2 miral-release)
  • Revision ID: ci-train-bot@canonical.com-20170316181719-97cag89m9ny90l2r
* New upstream release 1.3.1 (https://launchpad.net/miral/+milestone/1.3.1)
  - ABI summary:
    . miral ABI unchanged at 2
  - Enhancements:
    . [libmirclientcpp] RAII wrappers for MirBlob and MirCookie
    . spelling: SetWindowManagmentPolicy => SetWindowManagementPolicy
  - Bugs fixed:
    . [miral-shell] If a surface is deleted before its decoration is painted
      miral-shell can crash, or hang on exit (LP: #1673038)
    . [miral-shell] if the specified font doesn't exist the server crashes
      (LP: #1671028)
    . [libmiral] When a dialog is hidden ensure that the active window focus
      goes to the parent. (LP: #1671072)

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
#include <mir/test/signal.h>
29
29
 
30
30
#include <gtest/gtest.h>
 
31
#include <gmock/gmock.h>
31
32
 
32
33
using namespace testing;
33
34
using namespace mir::client;
35
36
using miral::WindowManagerTools;
36
37
 
37
38
#if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 5, 0)
38
 
auto const mir_window_set_state = mir_surface_set_state;
 
39
auto const mir_event_type_window = mir_event_type_surface;
39
40
auto const mir_window_event_get_attribute = mir_surface_event_get_attribute;
40
41
auto const mir_event_get_window_event = mir_event_get_surface_event;
41
42
#endif
359
360
 
360
361
    assert_active_window_is(test_name);
361
362
}
 
363
 
 
364
// lp:1671072
 
365
TEST_F(ActiveWindow, hiding_active_dialog_makes_parent_active)
 
366
{
 
367
    char const* const parent_name = __PRETTY_FUNCTION__;
 
368
    auto const dialog_name = "dialog";
 
369
    auto const connection = connect_client(parent_name);
 
370
 
 
371
    auto const parent = create_surface(connection, parent_name, sync1);
 
372
    auto const dialog = create_dialog(connection, dialog_name, parent, sync2);
 
373
 
 
374
    sync1.exec([&]{ mir_window_set_state(dialog, mir_window_state_hidden); });
 
375
 
 
376
    EXPECT_TRUE(sync1.signal_raised());
 
377
 
 
378
    assert_active_window_is(parent_name);
 
379
}
 
380
 
 
381
TEST_F(ActiveWindow, when_another_window_is_about_hiding_active_dialog_makes_parent_active)
 
382
{
 
383
    FocusChangeSync sync3;
 
384
    char const* const parent_name = __PRETTY_FUNCTION__;
 
385
    auto const dialog_name = "dialog";
 
386
    auto const another_window_name = "another window";
 
387
    auto const connection = connect_client(parent_name);
 
388
 
 
389
    auto const parent = create_surface(connection, parent_name, sync1);
 
390
    auto const another_window = create_surface(connection, another_window_name, sync2);
 
391
    auto const dialog = create_dialog(connection, dialog_name, parent, sync3);
 
392
 
 
393
    sync1.exec([&]{ mir_window_set_state(dialog, mir_window_state_hidden); });
 
394
 
 
395
    EXPECT_TRUE(sync1.signal_raised());
 
396
 
 
397
    assert_active_window_is(parent_name);
 
398
}