~ci-train-bot/indicator-sound/indicator-sound-ubuntu-zesty-2138

« back to all changes in this revision

Viewing changes to tests/integration/test-indicator.cpp

  • Committer: CI Train Bot
  • Author(s): Xavi Garcia Mena
  • Date: 2016-03-07 10:13:38 UTC
  • mfrom: (529.1.8 last-runnin-player-charles)
  • Revision ID: ci-train-bot@canonical.com-20160307101338-x2wynmsb4sch7jag
This branch sets the last running player using accounts service instead of gsettings.
It also includes a new class AccountsServiceAccess, to centralize all accesses to account service properties.
Approved by: PS Jenkins bot, Charles Kerr

Show diffs side-by-side

added added

removed removed

Lines of Context:
394
394
                        .string_attribute("x-canonical-type", "com.canonical.unity.media-player")
395
395
                    )
396
396
                    .item(mh::MenuItemMatcher()
397
 
                        .string_attribute("x-canonical-previous-action","indicator.previous.testplayer1.desktop")
398
397
                        .string_attribute("x-canonical-play-action","indicator.play.testplayer1.desktop")
399
 
                        .string_attribute("x-canonical-next-action","indicator.next.testplayer1.desktop")
400
398
                        .string_attribute("x-canonical-type","com.canonical.unity.playback-item")
401
399
                    )
402
400
                )
925
923
                        .string_attribute("x-canonical-type", "com.canonical.unity.media-player")
926
924
                    )
927
925
                    .item(mh::MenuItemMatcher()
928
 
                        .string_attribute("x-canonical-previous-action","indicator.previous.testplayer3.desktop")
929
 
                        .string_attribute("x-canonical-play-action","indicator.play.testplayer3.desktop")
930
 
                        .string_attribute("x-canonical-next-action","indicator.next.testplayer3.desktop")
931
 
                        .string_attribute("x-canonical-type","com.canonical.unity.playback-item")
932
 
                    )
933
 
                )
934
 
            .item(mh::MenuItemMatcher()
935
 
                            .label("Sound Settings…")
936
 
             )
937
 
        ).match());
 
926
                        .string_attribute("x-canonical-play-action","indicator.play.testplayer3.desktop")
 
927
                        .string_attribute("x-canonical-type","com.canonical.unity.playback-item")
 
928
                    )
 
929
                )
 
930
            .item(mh::MenuItemMatcher()
 
931
                            .label("Sound Settings…")
 
932
             )
 
933
        ).match());
 
934
 
 
935
    // check that the last running player is the one we expect
 
936
    QVariant lastPlayerRunning = waitLastRunningPlayerChanged();
 
937
    EXPECT_TRUE(lastPlayerRunning.type() == QVariant::String);
 
938
    EXPECT_EQ(lastPlayerRunning.toString(), "testplayer3.desktop");
 
939
 
 
940
    // restart the indicator to simulate a new user session
 
941
    ASSERT_NO_THROW(startIndicator());
 
942
 
 
943
    // check that player 3 is the only one with playback controls
 
944
    // as it was the last one being stopped
 
945
    EXPECT_MATCHRESULT(mh::MenuMatcher(desktopParameters())
 
946
        .item(mh::MenuItemMatcher()
 
947
            .action("indicator.root")
 
948
            .string_attribute("x-canonical-type", "com.canonical.indicator.root")
 
949
            .string_attribute("x-canonical-secondary-action", "indicator.mute")
 
950
            .mode(mh::MenuItemMatcher::Mode::all)
 
951
            .submenu()
 
952
            .item(mh::MenuItemMatcher()
 
953
                .section()
 
954
                .item(mh::MenuItemMatcher().checkbox()
 
955
                    .label("Mute")
 
956
                )
 
957
                .item(volumeSlider(INITIAL_VOLUME, "Volume"))
 
958
            )
 
959
            .item(mh::MenuItemMatcher()
 
960
                    .section()
 
961
                    .item(mh::MenuItemMatcher()
 
962
                        .action("indicator.testplayer3.desktop")
 
963
                        .label("TestPlayer3")
 
964
                        .themed_icon("icon", {"testplayer"})
 
965
                        .string_attribute("x-canonical-type", "com.canonical.unity.media-player")
 
966
                    )
 
967
                    .item(mh::MenuItemMatcher()
 
968
                        .string_attribute("x-canonical-play-action","indicator.play.testplayer3.desktop")
 
969
                        .string_attribute("x-canonical-type","com.canonical.unity.playback-item")
 
970
                    )
 
971
                )
 
972
            .item(mh::MenuItemMatcher()
 
973
                    .section()
 
974
                    .item(mh::MenuItemMatcher()
 
975
                        .action("indicator.testplayer1.desktop")
 
976
                        .label("TestPlayer1")
 
977
                        .themed_icon("icon", {"testplayer"})
 
978
                        .string_attribute("x-canonical-type", "com.canonical.unity.media-player")
 
979
                    )
 
980
            )
 
981
            .item(mh::MenuItemMatcher()
 
982
                    .section()
 
983
                    .item(mh::MenuItemMatcher()
 
984
                        .action("indicator.testplayer2.desktop")
 
985
                        .label("TestPlayer2")
 
986
                        .themed_icon("icon", {"testplayer"})
 
987
                        .string_attribute("x-canonical-type", "com.canonical.unity.media-player")
 
988
                    )
 
989
                )
 
990
            .item(mh::MenuItemMatcher()
 
991
                            .label("Sound Settings…")
 
992
             )
 
993
        ).match());
 
994
 
938
995
}
939
996
 
940
997
TEST_F(TestIndicator, DesktopMprisPlayerButtonsState)