1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
#include "drawtypes/iconset.hpp"
#include "common/test.hpp"
using namespace std;
using namespace polybar;
using namespace polybar::drawtypes;
TEST(IconSet, fuzzyMatchExactMatchFirst) {
iconset_t icons = make_shared<iconset>();
icons->add("1", make_shared<label>("1"));
icons->add("10", make_shared<label>("10"));
label_t ret = icons->get("10", "", true);
EXPECT_EQ("10", ret->get());
}
TEST(IconSet, fuzzyMatchLargestSubstring) {
iconset_t icons = make_shared<iconset>();
icons->add("1", make_shared<label>("1"));
icons->add("10", make_shared<label>("10"));
label_t ret = icons->get("10a", "", true);
EXPECT_EQ("10", ret->get());
}
TEST(IconSet, fuzzyMatchFallback) {
iconset_t icons = make_shared<iconset>();
icons->add("1", make_shared<label>("1"));
icons->add("10", make_shared<label>("10"));
icons->add("fallback_id", make_shared<label>("fallback_label"));
label_t ret = icons->get("b", "fallback_id", true);
EXPECT_EQ("fallback_label", ret->get());
}
|