add some asserts

This commit is contained in:
unknown 2024-10-17 20:35:52 +02:00
parent 39e0e00f2d
commit 1ca5d38ad5
2 changed files with 12 additions and 14 deletions

View file

@ -344,6 +344,9 @@ void NotebookTab::copyHighlightStateAndSourcesFrom(const NotebookTab *sourceTab)
{
if (this->isSelected())
{
assert(this->highlightSources_.highlightedSource.empty());
assert(this->highlightSources_.newMessageSource.empty());
assert(this->highlightState_ == HighlightState::None);
return;
}
@ -391,7 +394,6 @@ void NotebookTab::setSelected(bool value)
}
this->highlightSources_.clear();
this->highlightState_ = HighlightState::None;
this->update();
@ -453,9 +455,14 @@ void NotebookTab::setHighlightState(HighlightState newHighlightStyle)
{
if (this->isSelected())
{
assert(this->highlightSources_.highlightedSource.empty());
assert(this->highlightSources_.newMessageSource.empty());
assert(this->highlightState_ == HighlightState::None);
return;
}
this->highlightSources_.clear();
if (!this->highlightEnabled_ &&
newHighlightStyle == HighlightState::NewMessage)
{
@ -472,18 +479,15 @@ void NotebookTab::setHighlightState(HighlightState newHighlightStyle)
this->update();
}
void NotebookTab::forceHighlightState(HighlightState newHighlightStyle)
{
this->highlightState_ = newHighlightStyle;
this->update();
}
void NotebookTab::updateHighlightState(HighlightState newHighlightStyle,
const ChannelView &channelViewSource,
const MessagePtr &message)
{
if (this->isSelected())
{
assert(this->highlightSources_.highlightedSource.empty());
assert(this->highlightSources_.newMessageSource.empty());
assert(this->highlightState_ == HighlightState::None);
return;
}

View file

@ -61,17 +61,11 @@ public:
bool isLive() const;
/**
* @brief Sets the highlight state of this tab clearing out highlight sources
* @brief Sets the highlight state of this tab clearing highlight sources
*
* Obeys the HighlightsEnabled setting and highlight states hierarchy
*/
void setHighlightState(HighlightState style);
/**
* @brief Forces the highlight state of this tab
*
* Does NOT obey the HighlightsEnabled setting and the highlight states hierarchy
*/
void forceHighlightState(HighlightState style);
/**
* @brief Updates the highlight state and highlight sources of this tab
*