~xavi-garcia-mena/indicator-sound/icon-volume-zero

« back to all changes in this revision

Viewing changes to tests/notifications-test.cc

  • Committer: CI Train Bot
  • Author(s): Ted Gould
  • Date: 2015-02-27 22:36:07 UTC
  • mfrom: (480.2.3 lp1422745-max-volume)
  • Revision ID: ci-train-bot@canonical.com-20150227223607-qy2b08ku0axtx483
Use max volume in calculating notification value Fixes: #1422745
Approved by: Charles Kerr, PS Jenkins bot

Show diffs side-by-side

added added

removed removed

Lines of Context:
356
356
        EXPECT_EQ("High volume", notev[0].body);
357
357
        EXPECT_GVARIANT_EQ("@s 'true'", notev[0].hints["x-canonical-value-bar-tint"]);
358
358
}
 
359
 
 
360
TEST_F(NotificationsTest, ExtendendVolumeNotification) {
 
361
        auto volumeControl = volumeControlMock();
 
362
        auto soundService = standardService(volumeControl, playerListMock());
 
363
 
 
364
        /* Set a volume */
 
365
        notifications->clearNotifications();
 
366
        setMockVolume(volumeControl, 0.50);
 
367
        loop(50);
 
368
        auto notev = notifications->getNotifications();
 
369
        ASSERT_EQ(1, notev.size());
 
370
        EXPECT_EQ("indicator-sound", notev[0].app_name);
 
371
        EXPECT_EQ("Volume", notev[0].summary);
 
372
        EXPECT_EQ(0, notev[0].actions.size());
 
373
        EXPECT_GVARIANT_EQ("@s 'true'", notev[0].hints["x-canonical-private-synchronous"]);
 
374
        EXPECT_GVARIANT_EQ("@i 50", notev[0].hints["value"]);
 
375
 
 
376
        /* Allow an amplified volume */
 
377
        notifications->clearNotifications();
 
378
        indicator_sound_service_set_allow_amplified_volume(soundService.get(), TRUE);
 
379
        loop(50);
 
380
        notev = notifications->getNotifications();
 
381
        ASSERT_EQ(1, notev.size());
 
382
        EXPECT_GVARIANT_EQ("@i 33", notev[0].hints["value"]);
 
383
 
 
384
        /* Set to 'over max' */
 
385
        notifications->clearNotifications();
 
386
        setMockVolume(volumeControl, 1.525);
 
387
        loop(50);
 
388
        notev = notifications->getNotifications();
 
389
        ASSERT_EQ(1, notev.size());
 
390
        EXPECT_GVARIANT_EQ("@i 100", notev[0].hints["value"]);
 
391
 
 
392
        /* Put back */
 
393
        notifications->clearNotifications();
 
394
        indicator_sound_service_set_allow_amplified_volume(soundService.get(), FALSE);
 
395
        loop(50);
 
396
        notev = notifications->getNotifications();
 
397
        ASSERT_EQ(1, notev.size());
 
398
        EXPECT_GVARIANT_EQ("@i 100", notev[0].hints["value"]);
 
399
}
 
400