2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Display active feed state in dialogs list.

This commit is contained in:
John Preston
2018-01-22 19:42:25 +03:00
parent 840b42934b
commit 47ad5ea98a
29 changed files with 381 additions and 250 deletions

View File

@@ -26,7 +26,7 @@ public:
>();
return std::move(initial).start(
[consumer, previous](auto &&value) {
if (auto exists = *previous) {
if (auto &exists = *previous) {
auto &existing = *exists;
auto next = std::make_tuple(
std::move(existing),

View File

@@ -401,6 +401,35 @@ TEST_CASE("basic operators tests", "[rpl::operators]") {
REQUIRE(*sum == "0-11-22-3");
}
SECTION("combine_previous test") {
auto sum = std::make_shared<std::string>("");
{
rpl::lifetime lifetime;
event_stream<int> a;
a.events(
) | combine_previous(
) | start_with_next([=](int previous, int next) {
*sum += std::to_string(previous) + ' ';
*sum += std::to_string(next) + ' ';
}, lifetime);
a.events(
) | combine_previous(
5
) | start_with_next([=](int previous, int next) {
*sum += std::to_string(10 + previous) + ' ';
*sum += std::to_string(next) + ' ';
}, lifetime);
a.fire(1);
a.fire(2);
a.fire(3);
a.fire(4);
}
REQUIRE(*sum == "15 1 1 2 11 2 2 3 12 3 3 4 13 4 ");
}
SECTION("take test") {
auto sum = std::make_shared<std::string>("");
{