2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Replace t_assert() with Assert().

Also use this assertions for Expects(), Ensures() and Unexpected().
This commit is contained in:
John Preston
2017-08-17 12:06:26 +03:00
parent b3da99c302
commit 25ffaaaa2d
107 changed files with 492 additions and 435 deletions

View File

@@ -82,17 +82,17 @@ void IndexedList::moveToTop(PeerData *peer) {
void IndexedList::movePinned(Row *row, int deltaSign) {
auto swapPinnedIndexWith = find(row);
t_assert(swapPinnedIndexWith != cend());
Assert(swapPinnedIndexWith != cend());
if (deltaSign > 0) {
++swapPinnedIndexWith;
} else {
t_assert(swapPinnedIndexWith != cbegin());
Assert(swapPinnedIndexWith != cbegin());
--swapPinnedIndexWith;
}
auto history1 = row->history();
auto history2 = (*swapPinnedIndexWith)->history();
t_assert(history1->isPinnedDialog());
t_assert(history2->isPinnedDialog());
Assert(history1->isPinnedDialog());
Assert(history2->isPinnedDialog());
auto index1 = history1->getPinnedIndex();
auto index2 = history2->getPinnedIndex();
history1->setPinnedIndex(index2);
@@ -100,7 +100,7 @@ void IndexedList::movePinned(Row *row, int deltaSign) {
}
void IndexedList::peerNameChanged(PeerData *peer, const PeerData::Names &oldNames, const PeerData::NameFirstChars &oldChars) {
t_assert(_sortMode != SortMode::Date);
Assert(_sortMode != SortMode::Date);
if (_sortMode == SortMode::Name) {
adjustByName(peer, oldNames, oldChars);
} else {
@@ -109,7 +109,7 @@ void IndexedList::peerNameChanged(PeerData *peer, const PeerData::Names &oldName
}
void IndexedList::peerNameChanged(Mode list, PeerData *peer, const PeerData::Names &oldNames, const PeerData::NameFirstChars &oldChars) {
t_assert(_sortMode == SortMode::Date);
Assert(_sortMode == SortMode::Date);
adjustNames(list, peer, oldNames, oldChars);
}

View File

@@ -729,7 +729,7 @@ int DialogsInner::updateReorderIndexGetCount() {
}
auto count = shownPinnedCount();
t_assert(index < count);
Assert(index < count);
if (count < 2) {
stopReorderPinned();
return 0;

View File

@@ -203,7 +203,7 @@ const style::icon *ChatTypeIcon(PeerData *peer, bool active, bool selected) {
}
void paintUnreadBadge(Painter &p, const QRect &rect, const UnreadBadgeStyle &st) {
t_assert(rect.height() == st.size);
Assert(rect.height() == st.size);
int index = (st.muted ? 0x03 : 0x00) + (st.active ? 0x02 : (st.selected ? 0x01 : 0x00));
int size = st.size, sizehalf = size / 2;
@@ -211,7 +211,7 @@ void paintUnreadBadge(Painter &p, const QRect &rect, const UnreadBadgeStyle &st)
unreadBadgeStyle.createIfNull();
auto badgeData = unreadBadgeStyle->sizes;
if (st.sizeId > 0) {
t_assert(st.sizeId < UnreadBadgeSizesCount);
Assert(st.sizeId < UnreadBadgeSizesCount);
badgeData = &unreadBadgeStyle->sizes[st.sizeId];
}
auto bg = unreadBadgeStyle->bg[index];

View File

@@ -382,7 +382,7 @@ void DialogsWidget::dialogsReceived(const MTPmessages_Dialogs &dialogs, mtpReque
_dialogsFull = true;
}
t_assert(messagesList != nullptr);
Assert(messagesList != nullptr);
App::feedMsgs(*messagesList, NewMessageLast);
unreadCountsReceived(*dialogsList);