Add more tests
This commit is contained in:
@@ -23,14 +23,6 @@ QQC2.ToolBar {
|
||||
|
||||
required property MessageContent.ChatBarMessageContentModel contentModel
|
||||
|
||||
Connections {
|
||||
target: contentModel
|
||||
|
||||
function onFocusRowChanged() {
|
||||
console.warn("focus changed", contentModel.focusRow, contentModel.focusType)
|
||||
}
|
||||
}
|
||||
|
||||
required property real maxAvailableWidth
|
||||
|
||||
readonly property real uncompressedImplicitWidth: textFormatRow.implicitWidth +
|
||||
|
||||
@@ -87,7 +87,7 @@ QQC2.Popup {
|
||||
radius: Kirigami.Units.cornerRadius
|
||||
border {
|
||||
width: 1
|
||||
color: styleDelegate.hovered || root.chatButtonHelper.currentStyle === styleDelegate.index ?
|
||||
color: styleDelegate.hovered || (root.chatButtonHelper.currentStyle === styleDelegate.index) ?
|
||||
Kirigami.Theme.highlightColor :
|
||||
Kirigami.ColorUtils.linearInterpolation(
|
||||
Kirigami.Theme.backgroundColor,
|
||||
|
||||
@@ -44,7 +44,11 @@ bool ChatButtonHelper::bold() const
|
||||
if (!m_textItem) {
|
||||
return false;
|
||||
}
|
||||
return m_textItem->formatsAtCursor().contains(RichFormat::Bold);
|
||||
const auto cursor = m_textItem->textCursor();
|
||||
if (cursor.isNull()) {
|
||||
return false;
|
||||
}
|
||||
return RichFormat::formatsAtCursor(cursor).contains(RichFormat::Bold);
|
||||
}
|
||||
|
||||
bool ChatButtonHelper::italic() const
|
||||
@@ -52,7 +56,11 @@ bool ChatButtonHelper::italic() const
|
||||
if (!m_textItem) {
|
||||
return false;
|
||||
}
|
||||
return m_textItem->formatsAtCursor().contains(RichFormat::Italic);
|
||||
const auto cursor = m_textItem->textCursor();
|
||||
if (cursor.isNull()) {
|
||||
return false;
|
||||
}
|
||||
return RichFormat::formatsAtCursor(cursor).contains(RichFormat::Italic);
|
||||
}
|
||||
|
||||
bool ChatButtonHelper::underline() const
|
||||
@@ -60,7 +68,11 @@ bool ChatButtonHelper::underline() const
|
||||
if (!m_textItem) {
|
||||
return false;
|
||||
}
|
||||
return m_textItem->formatsAtCursor().contains(RichFormat::Underline);
|
||||
const auto cursor = m_textItem->textCursor();
|
||||
if (cursor.isNull()) {
|
||||
return false;
|
||||
}
|
||||
return RichFormat::formatsAtCursor(cursor).contains(RichFormat::Underline);
|
||||
}
|
||||
|
||||
bool ChatButtonHelper::strikethrough() const
|
||||
@@ -68,7 +80,11 @@ bool ChatButtonHelper::strikethrough() const
|
||||
if (!m_textItem) {
|
||||
return false;
|
||||
}
|
||||
return m_textItem->formatsAtCursor().contains(RichFormat::Strikethrough);
|
||||
const auto cursor = m_textItem->textCursor();
|
||||
if (cursor.isNull()) {
|
||||
return false;
|
||||
}
|
||||
return RichFormat::formatsAtCursor(cursor).contains(RichFormat::Strikethrough);
|
||||
}
|
||||
|
||||
bool ChatButtonHelper::unorderedList() const
|
||||
@@ -76,7 +92,11 @@ bool ChatButtonHelper::unorderedList() const
|
||||
if (!m_textItem) {
|
||||
return false;
|
||||
}
|
||||
return m_textItem->formatsAtCursor().contains(RichFormat::UnorderedList);
|
||||
const auto cursor = m_textItem->textCursor();
|
||||
if (cursor.isNull()) {
|
||||
return false;
|
||||
}
|
||||
return RichFormat::formatsAtCursor(cursor).contains(RichFormat::UnorderedList);
|
||||
}
|
||||
|
||||
bool ChatButtonHelper::orderedList() const
|
||||
@@ -84,7 +104,11 @@ bool ChatButtonHelper::orderedList() const
|
||||
if (!m_textItem) {
|
||||
return false;
|
||||
}
|
||||
return m_textItem->formatsAtCursor().contains(RichFormat::OrderedList);
|
||||
const auto cursor = m_textItem->textCursor();
|
||||
if (cursor.isNull()) {
|
||||
return false;
|
||||
}
|
||||
return RichFormat::formatsAtCursor(cursor).contains(RichFormat::OrderedList);
|
||||
}
|
||||
|
||||
RichFormat::Format ChatButtonHelper::currentStyle() const
|
||||
|
||||
Reference in New Issue
Block a user