Check formatting help placement and document flexible code fences
This commit is contained in:
1 parent
1d323a1db6
commit
10e7eeee3f
2 files changed
+21
-2
No files matched your search
@@ -21,9 +21,11 @@ Qt-клиент поддерживает `**жирный**`, `__курсив__`,
|
||||
обратную кавычку и саму себя. Внутри URL escapes и открывающие маркеры не обрабатываются.
|
||||
|
||||
Открывающая строка кода содержит ровно три обратные кавычки и необязательное имя языка,
|
||||
без пробелов, например `cpp`, `c`, `python`, `py`, `js`, `json`, `bash`, `sql`.
|
||||
Закрывающая строка содержит только три обратные кавычки. Начало/конец сообщения также
|
||||
например `cpp`, `c`, `python`, `py`, `js`, `json`, `bash`, `sql`.
|
||||
До/после кавычек и вокруг имени языка допустимы пробелы и табуляции: ` ``` cpp ` тоже работает.
|
||||
Закрывающая строка содержит три обратные кавычки с необязательными пробелами вокруг. Начало/конец сообщения также
|
||||
считаются границами строк; принимаются LF и CRLF. Несколько блоков в сообщении допустимы.
|
||||
Пробелы внутри самого кода сохраняются. Кнопка `?` справа от Join открывает краткую подсказку по тегам и блокам кода.
|
||||
|
||||
````text
|
||||
**Пример:**
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <QPushButton>
|
||||
#include <QToolTip>
|
||||
#include <QEnterEvent>
|
||||
#include <QMessageBox>
|
||||
extern "C" {
|
||||
#include "utun_instance.h"
|
||||
#include "chat/chat_core.h"
|
||||
@@ -71,6 +72,22 @@ private slots:
|
||||
}
|
||||
}
|
||||
|
||||
void formattingHelpNextToJoin() {
|
||||
ChannelList list; list.resize(400, 250); list.show(); QCoreApplication::processEvents();
|
||||
auto* join = list.findChild<QPushButton*>("joinGroupButton");
|
||||
auto* helpButton = list.findChild<QPushButton*>("messageFormattingHelpButton");
|
||||
QVERIFY(join && helpButton); QVERIFY(helpButton->isVisible());
|
||||
QVERIFY(helpButton->mapTo(&list, QPoint()).x() > join->mapTo(&list, QPoint()).x());
|
||||
QSignalSpy joined(&list, &ChannelList::joinRequested);
|
||||
QTest::mouseClick(helpButton, Qt::LeftButton);
|
||||
QPointer<QMessageBox> help = list.findChild<QMessageBox*>("messageFormattingHelp");
|
||||
QVERIFY(help); QTRY_VERIFY(help->isVisible()); QCOMPARE(help->textFormat(), Qt::PlainText);
|
||||
for (const QString& text : {"**text**", "__text__", "~~text~~", "```cpp\nint value = 42;\n```", "Spaces around ```"})
|
||||
QVERIFY2(help->text().contains(text), qPrintable(text));
|
||||
QVERIFY(joined.isEmpty()); QVERIFY(help->grab().save(QDir::tempPath() + "/message-formatting-help.png"));
|
||||
help->accept(); QTRY_VERIFY(help.isNull());
|
||||
}
|
||||
|
||||
void reloadKeepsConnectionState() {
|
||||
ListCore core; QVERIFY(core.start());
|
||||
ChannelList list(&core.db); list.loadChannels();
|
||||
|
||||
Reference in new issue
Block a user