Add fix_formatted_text test.
GitOrigin-RevId: 995b645cb0d6699abb5bc96f74ac766e8beef9d1
This commit is contained in:
parent
87d875ca81
commit
1b7d3e0672
@ -9,6 +9,7 @@
|
||||
#include "td/utils/format.h"
|
||||
#include "td/utils/logging.h"
|
||||
#include "td/utils/tests.h"
|
||||
#include "td/utils/utf8.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@ -702,4 +703,21 @@ TEST(MessageEntities, fix_formatted_text) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (auto text : {" \n ➡️ ➡️ ➡️ ➡️ \n ", "\n\n\nab cd ef gh "}) {
|
||||
str = text;
|
||||
vector<MessageEntity> entities;
|
||||
vector<MessageEntity> fixed_entities;
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
entities.emplace_back(MessageEntity::Type::Bold, (i + 1) * 3, 2);
|
||||
entities.emplace_back(MessageEntity::Type::Italic, (i + 1) * 3 + 2, 1);
|
||||
|
||||
if (i < 4) {
|
||||
fixed_entities.emplace_back(MessageEntity::Type::Bold, i * 3, 2);
|
||||
}
|
||||
}
|
||||
|
||||
check_fix_formatted_text(str, entities, utf8_utf16_substr(str, 3, 11), fixed_entities, false, false, false, false);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user