~ubuntu-branches/ubuntu/utopic/unity-scope-click/utopic-proposed

« back to all changes in this revision

Viewing changes to scope/tests/test_query.cpp

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release, Alejandro J. Cura (alecu)
  • Date: 2014-08-27 19:09:01 UTC
  • mfrom: (1.1.71)
  • Revision ID: package-import@ubuntu.com-20140827190901-szvn6llmndyx0g2b
Tags: 0.1.1+14.10.20140827-0ubuntu1
[ Alejandro J. Cura (alecu) ]
* New upstream release.
  - Skip broken entries in click list. (LP: #1356837)
  - Do not push preview widgets until all data is available. (LP: #1360384)
  - Add the price and rating as attributes in search results. (LP: #1350561)
  - Improved card style for categories with just scopes. (LP: #1359900)
  - Updated translations.

Show diffs side-by-side

added added

removed removed

Lines of Context:
528
528
 
529
529
    ASSERT_EQ(unsetenv(Configuration::PURCHASES_ENVVAR), 0);
530
530
}
 
531
 
 
532
MATCHER_P(HasAttributes, b, "") { return !arg["attributes"].is_null() == b; }
 
533
 
 
534
TEST(QueryTest, testPushPackagePushesAttributes)
 
535
{
 
536
    click::Packages packages {
 
537
        {"org.example.app1", "app title1", 0.0, "icon", "uri"},
 
538
    };
 
539
    MockIndex mock_index(packages);
 
540
    scopes::SearchMetadata metadata("en_EN", "phone");
 
541
    PackageSet no_installed_packages;
 
542
    click::DepartmentLookup dept_lookup;
 
543
    click::HighlightList highlights;
 
544
    MockPayPackage pay_pkg;
 
545
    const unity::scopes::CannedQuery query("foo.scope", FAKE_QUERY, "");
 
546
    MockQuery q(query, mock_index, dept_lookup, nullptr, highlights, metadata, pay_pkg);
 
547
    EXPECT_CALL(mock_index, do_search(FAKE_QUERY, _));
 
548
 
 
549
    scopes::CategoryRenderer renderer("{}");
 
550
    auto ptrCat = std::make_shared<FakeCategory>("id", "", "", renderer);
 
551
    EXPECT_CALL(q, register_category(_, _, _, _, _)).Times(2).WillRepeatedly(Return(ptrCat));
 
552
 
 
553
    scopes::testing::MockSearchReply mock_reply;
 
554
    scopes::SearchReplyProxy reply(&mock_reply, [](unity::scopes::SearchReply*){});
 
555
    EXPECT_CALL(q, push_result(_, HasAttributes(true)));
 
556
    q.wrap_add_available_apps(reply, no_installed_packages, FAKE_CATEGORY_TEMPLATE);
 
557
}