1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 16:37:47 +00:00

Everywhere: Rename ASSERT => VERIFY

(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED)

Since all of these checks are done in release builds as well,
let's rename them to VERIFY to prevent confusion, as everyone is
used to assertions being compiled out in release.

We can introduce a new ASSERT macro that is specifically for debug
checks, but I'm doing this wholesale conversion first since we've
accumulated thousands of these already, and it's not immediately
obvious which ones are suitable for ASSERT.
This commit is contained in:
Andreas Kling 2021-02-23 20:42:32 +01:00
parent b33a6a443e
commit 5d180d1f99
725 changed files with 3448 additions and 3448 deletions

View file

@ -49,7 +49,7 @@ AppletManager::~AppletManager()
AppletManager& AppletManager::the()
{
ASSERT(s_the);
VERIFY(s_the);
return *s_the;
}

View file

@ -537,14 +537,14 @@ void ClientConnection::destroy_window(Window& window, Vector<i32>& destroyed_win
for (auto& child_window : window.child_windows()) {
if (!child_window)
continue;
ASSERT(child_window->window_id() != window.window_id());
VERIFY(child_window->window_id() != window.window_id());
destroy_window(*child_window, destroyed_window_ids);
}
for (auto& accessory_window : window.accessory_windows()) {
if (!accessory_window)
continue;
ASSERT(accessory_window->window_id() != window.window_id());
VERIFY(accessory_window->window_id() != window.window_id());
destroy_window(*accessory_window, destroyed_window_ids);
}

View file

@ -221,15 +221,15 @@ void Compositor::compose()
auto prepare_rect = [&](const Gfx::IntRect& rect) {
dbgln_if(COMPOSE_DEBUG, " -> flush opaque: {}", rect);
ASSERT(!flush_rects.intersects(rect));
ASSERT(!flush_transparent_rects.intersects(rect));
VERIFY(!flush_rects.intersects(rect));
VERIFY(!flush_transparent_rects.intersects(rect));
flush_rects.add(rect);
check_restore_cursor_back(rect);
};
auto prepare_transparency_rect = [&](const Gfx::IntRect& rect) {
dbgln_if(COMPOSE_DEBUG, " -> flush transparent: {}", rect);
ASSERT(!flush_rects.intersects(rect));
VERIFY(!flush_rects.intersects(rect));
for (auto& r : flush_transparent_rects.rects()) {
if (r == rect)
return;
@ -261,7 +261,7 @@ void Compositor::compose()
auto src_rect = Gfx::FloatRect { rect.x() * hscale, rect.y() * vscale, rect.width() * hscale, rect.height() * vscale };
painter.draw_scaled_bitmap(rect, *m_wallpaper, src_rect);
} else {
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}
};
@ -434,7 +434,7 @@ void Compositor::compose()
}
// Check that there are no overlapping transparent and opaque flush rectangles
ASSERT(![&]() {
VERIFY(![&]() {
for (auto& rect_transparent : flush_transparent_rects.rects()) {
for (auto& rect_opaque : flush_rects.rects()) {
if (rect_opaque.intersects(rect_transparent)) {
@ -649,7 +649,7 @@ bool Compositor::set_wallpaper(const String& path, Function<void(bool)>&& callba
void Compositor::flip_buffers()
{
ASSERT(m_screen_can_set_buffer);
VERIFY(m_screen_can_set_buffer);
swap(m_front_bitmap, m_back_bitmap);
swap(m_front_painter, m_back_painter);
Screen::the().set_buffer(m_buffers_are_flipped ? 0 : 1);
@ -838,7 +838,7 @@ void Compositor::increment_display_link_count(Badge<ClientConnection>)
void Compositor::decrement_display_link_count(Badge<ClientConnection>)
{
ASSERT(m_display_link_count);
VERIFY(m_display_link_count);
--m_display_link_count;
if (!m_display_link_count)
m_display_link_notify_timer->stop();
@ -1024,7 +1024,7 @@ void Compositor::recompute_occlusions()
if (!transparency_rects.is_empty())
have_transparent = true;
ASSERT(!visible_opaque.intersects(transparency_rects));
VERIFY(!visible_opaque.intersects(transparency_rects));
// Determine visible area for the window below
if (w.is_opaque()) {
@ -1089,9 +1089,9 @@ void Compositor::recompute_occlusions()
dbgln(" transparent: {}", r);
}
ASSERT(!w.opaque_rects().intersects(m_opaque_wallpaper_rects));
ASSERT(!w.transparency_rects().intersects(m_opaque_wallpaper_rects));
ASSERT(!w.transparency_wallpaper_rects().intersects(m_opaque_wallpaper_rects));
VERIFY(!w.opaque_rects().intersects(m_opaque_wallpaper_rects));
VERIFY(!w.transparency_rects().intersects(m_opaque_wallpaper_rects));
VERIFY(!w.transparency_wallpaper_rects().intersects(m_opaque_wallpaper_rects));
return IterationDecision::Continue;
});
}

View file

@ -125,7 +125,7 @@ Cursor::Cursor(NonnullRefPtr<Gfx::Bitmap>&& bitmap, const CursorParams& cursor_p
, m_rect(m_bitmap->rect())
{
if (m_params.frames() > 1) {
ASSERT(m_rect.width() % m_params.frames() == 0);
VERIFY(m_rect.width() % m_params.frames() == 0);
m_rect.set_width(m_rect.width() / m_params.frames());
}
}
@ -182,7 +182,7 @@ RefPtr<Cursor> Cursor::create(Gfx::StandardCursor standard_cursor)
case Gfx::StandardCursor::Wait:
return WindowManager::the().wait_cursor();
default:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}

View file

@ -52,7 +52,7 @@ EventLoop::EventLoop()
m_mouse_fd = open("/dev/mouse", O_RDONLY | O_NONBLOCK | O_CLOEXEC);
bool ok = m_server->take_over_from_system_server();
ASSERT(ok);
VERIFY(ok);
m_server->on_ready_to_accept = [this] {
auto client_socket = m_server->accept();
@ -145,7 +145,7 @@ void EventLoop::drain_keyboard()
ssize_t nread = read(m_keyboard_fd, (u8*)&event, sizeof(::KeyEvent));
if (nread == 0)
break;
ASSERT(nread == sizeof(::KeyEvent));
VERIFY(nread == sizeof(::KeyEvent));
screen.on_receive_keyboard_data(event);
}
}

View file

@ -172,7 +172,7 @@ int Menu::visible_item_count() const
{
if (!is_scrollable())
return m_items.size();
ASSERT(m_menu_window);
VERIFY(m_menu_window);
// Make space for up/down arrow indicators
return m_menu_window->height() / item_height() - 2;
}
@ -182,8 +182,8 @@ void Menu::draw()
auto palette = WindowManager::the().palette();
m_theme_index_at_last_paint = MenuManager::the().theme_index();
ASSERT(menu_window());
ASSERT(menu_window()->backing_store());
VERIFY(menu_window());
VERIFY(menu_window()->backing_store());
Gfx::Painter painter(*menu_window()->backing_store());
Gfx::IntRect rect { {}, menu_window()->size() };
@ -297,7 +297,7 @@ MenuItem* Menu::hovered_item() const
void Menu::update_for_new_hovered_item(bool make_input)
{
if (hovered_item() && hovered_item()->is_submenu()) {
ASSERT(menu_window());
VERIFY(menu_window());
MenuManager::the().close_everyone_not_in_lineage(*hovered_item()->submenu());
hovered_item()->submenu()->do_popup(hovered_item()->rect().top_right().translated(menu_window()->rect().location()), make_input);
} else {
@ -309,8 +309,8 @@ void Menu::update_for_new_hovered_item(bool make_input)
void Menu::open_hovered_item()
{
ASSERT(menu_window());
ASSERT(menu_window()->is_visible());
VERIFY(menu_window());
VERIFY(menu_window()->is_visible());
if (!hovered_item())
return;
if (hovered_item()->is_enabled())
@ -320,17 +320,17 @@ void Menu::open_hovered_item()
void Menu::descend_into_submenu_at_hovered_item()
{
ASSERT(hovered_item());
VERIFY(hovered_item());
auto submenu = hovered_item()->submenu();
ASSERT(submenu);
VERIFY(submenu);
MenuManager::the().open_menu(*submenu, false, false);
submenu->set_hovered_item(0);
ASSERT(submenu->hovered_item()->type() != MenuItem::Separator);
VERIFY(submenu->hovered_item()->type() != MenuItem::Separator);
}
void Menu::handle_mouse_move_event(const MouseEvent& mouse_event)
{
ASSERT(menu_window());
VERIFY(menu_window());
MenuManager::the().set_current_menu(this);
if (hovered_item() && hovered_item()->is_submenu()) {
@ -368,7 +368,7 @@ void Menu::event(Core::Event& event)
}
if (event.type() == Event::MouseWheel && is_scrollable()) {
ASSERT(menu_window());
VERIFY(menu_window());
auto& mouse_event = static_cast<const MouseEvent&>(event);
m_scroll_offset += mouse_event.wheel_delta();
m_scroll_offset = clamp(m_scroll_offset, 0, m_max_scroll_offset);
@ -388,8 +388,8 @@ void Menu::event(Core::Event& event)
if (!(key == Key_Up || key == Key_Down || key == Key_Left || key == Key_Right || key == Key_Return))
return;
ASSERT(menu_window());
ASSERT(menu_window()->is_visible());
VERIFY(menu_window());
VERIFY(menu_window()->is_visible());
// Default to the first enabled, non-separator item on key press if one has not been selected yet
if (!hovered_item()) {
@ -406,7 +406,7 @@ void Menu::event(Core::Event& event)
}
if (key == Key_Up) {
ASSERT(m_items.at(0).type() != MenuItem::Separator);
VERIFY(m_items.at(0).type() != MenuItem::Separator);
if (is_scrollable() && m_hovered_item_index == 0)
return;
@ -421,7 +421,7 @@ void Menu::event(Core::Event& event)
return;
} while (hovered_item()->type() == MenuItem::Separator || !hovered_item()->is_enabled());
ASSERT(m_hovered_item_index >= 0 && m_hovered_item_index <= static_cast<int>(m_items.size()) - 1);
VERIFY(m_hovered_item_index >= 0 && m_hovered_item_index <= static_cast<int>(m_items.size()) - 1);
if (is_scrollable() && m_hovered_item_index < m_scroll_offset)
--m_scroll_offset;
@ -431,7 +431,7 @@ void Menu::event(Core::Event& event)
}
if (key == Key_Down) {
ASSERT(m_items.at(0).type() != MenuItem::Separator);
VERIFY(m_items.at(0).type() != MenuItem::Separator);
if (is_scrollable() && m_hovered_item_index == static_cast<int>(m_items.size()) - 1)
return;
@ -446,7 +446,7 @@ void Menu::event(Core::Event& event)
return;
} while (hovered_item()->type() == MenuItem::Separator || !hovered_item()->is_enabled());
ASSERT(m_hovered_item_index >= 0 && m_hovered_item_index <= static_cast<int>(m_items.size()) - 1);
VERIFY(m_hovered_item_index >= 0 && m_hovered_item_index <= static_cast<int>(m_items.size()) - 1);
if (is_scrollable() && m_hovered_item_index >= (m_scroll_offset + visible_item_count()))
++m_scroll_offset;

View file

@ -81,15 +81,15 @@ void MenuItem::set_default(bool is_default)
Menu* MenuItem::submenu()
{
ASSERT(is_submenu());
ASSERT(m_menu.client());
VERIFY(is_submenu());
VERIFY(m_menu.client());
return m_menu.client()->find_menu_by_id(m_submenu_id);
}
const Menu* MenuItem::submenu() const
{
ASSERT(is_submenu());
ASSERT(m_menu.client());
VERIFY(is_submenu());
VERIFY(m_menu.client());
return m_menu.client()->find_menu_by_id(m_submenu_id);
}

View file

@ -44,7 +44,7 @@ static constexpr int s_search_timeout = 3000;
MenuManager& MenuManager::the()
{
ASSERT(s_the);
VERIFY(s_the);
return *s_the;
}
@ -162,7 +162,7 @@ void MenuManager::event(Core::Event& event)
if (key_event.key() == Key_Left) {
auto it = m_open_menu_stack.find_if([&](const auto& other) { return m_current_menu == other.ptr(); });
ASSERT(!it.is_end());
VERIFY(!it.is_end());
// Going "back" a menu should be the previous menu in the stack
if (it.index() > 0)
@ -229,13 +229,13 @@ void MenuManager::handle_mouse_event(MouseEvent& mouse_event)
if (has_open_menu()) {
auto* topmost_menu = m_open_menu_stack.last().ptr();
ASSERT(topmost_menu);
VERIFY(topmost_menu);
auto* window = topmost_menu->menu_window();
if (!window) {
dbgln("MenuManager::handle_mouse_event: No menu window");
return;
}
ASSERT(window->is_visible());
VERIFY(window->is_visible());
bool event_is_inside_current_menu = window->rect().contains(mouse_event.position());
if (event_is_inside_current_menu) {
@ -326,7 +326,7 @@ void MenuManager::close_all_menus_from_client(Badge<ClientConnection>, ClientCon
void MenuManager::close_everyone()
{
for (auto& menu : m_open_menu_stack) {
ASSERT(menu);
VERIFY(menu);
if (menu->menu_window())
menu->menu_window()->set_visible(false);
menu->clear_hovered_item();
@ -440,7 +440,7 @@ void MenuManager::set_current_menu(Menu* menu)
return;
}
ASSERT(is_open(*menu));
VERIFY(is_open(*menu));
if (menu == m_current_menu) {
return;
}

View file

@ -43,18 +43,18 @@ static Screen* s_the;
Screen& Screen::the()
{
ASSERT(s_the);
VERIFY(s_the);
return *s_the;
}
Screen::Screen(unsigned desired_width, unsigned desired_height, int scale_factor)
{
ASSERT(!s_the);
VERIFY(!s_the);
s_the = this;
m_framebuffer_fd = open("/dev/fb0", O_RDWR | O_CLOEXEC);
if (m_framebuffer_fd < 0) {
perror("failed to open /dev/fb0");
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
if (fb_set_buffer(m_framebuffer_fd, 0) == 0) {
@ -93,7 +93,7 @@ bool Screen::set_resolution(int width, int height, int new_scale_factor)
on_change_resolution(physical_resolution.pitch, physical_resolution.width, physical_resolution.height, new_scale_factor);
return false;
}
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
void Screen::on_change_resolution(int pitch, int new_physical_width, int new_physical_height, int new_scale_factor)
@ -102,14 +102,14 @@ void Screen::on_change_resolution(int pitch, int new_physical_width, int new_phy
if (m_framebuffer) {
size_t previous_size_in_bytes = m_size_in_bytes;
int rc = munmap(m_framebuffer, previous_size_in_bytes);
ASSERT(rc == 0);
VERIFY(rc == 0);
}
int rc = fb_get_size_in_bytes(m_framebuffer_fd, &m_size_in_bytes);
ASSERT(rc == 0);
VERIFY(rc == 0);
m_framebuffer = (Gfx::RGBA32*)mmap(nullptr, m_size_in_bytes, PROT_READ | PROT_WRITE, MAP_SHARED, m_framebuffer_fd, 0);
ASSERT(m_framebuffer && m_framebuffer != (void*)-1);
VERIFY(m_framebuffer && m_framebuffer != (void*)-1);
}
m_pitch = pitch;
@ -122,20 +122,20 @@ void Screen::on_change_resolution(int pitch, int new_physical_width, int new_phy
void Screen::set_buffer(int index)
{
ASSERT(m_can_set_buffer);
VERIFY(m_can_set_buffer);
int rc = fb_set_buffer(m_framebuffer_fd, index);
ASSERT(rc == 0);
VERIFY(rc == 0);
}
void Screen::set_acceleration_factor(double factor)
{
ASSERT(factor >= mouse_accel_min && factor <= mouse_accel_max);
VERIFY(factor >= mouse_accel_min && factor <= mouse_accel_max);
m_acceleration_factor = factor;
}
void Screen::set_scroll_step_size(unsigned step_size)
{
ASSERT(step_size >= scroll_step_size_min);
VERIFY(step_size >= scroll_step_size_min);
m_scroll_step_size = step_size;
}

View file

@ -153,7 +153,7 @@ void Window::set_title(const String& title)
void Window::set_rect(const Gfx::IntRect& rect)
{
ASSERT(!rect.is_empty());
VERIFY(!rect.is_empty());
if (m_rect == rect)
return;
auto old_rect = m_rect;
@ -168,7 +168,7 @@ void Window::set_rect(const Gfx::IntRect& rect)
void Window::set_rect_without_repaint(const Gfx::IntRect& rect)
{
ASSERT(!rect.is_empty());
VERIFY(!rect.is_empty());
if (m_rect == rect)
return;
auto old_rect = m_rect;
@ -232,7 +232,7 @@ void Window::nudge_into_desktop(bool force_titlebar_visible)
void Window::set_minimum_size(const Gfx::IntSize& size)
{
ASSERT(!size.is_empty());
VERIFY(!size.is_empty());
if (m_minimum_size == size)
return;
@ -265,7 +265,7 @@ void Window::handle_mouse_event(const MouseEvent& event)
m_client->post_message(Messages::WindowClient::MouseWheel(m_window_id, event.position(), (u32)event.button(), event.buttons(), event.modifiers(), event.wheel_delta()));
break;
default:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}
@ -332,7 +332,7 @@ void Window::start_minimize_animation()
// next time we want to start the animation
m_taskbar_rect = w.taskbar_rect();
ASSERT(!m_have_taskbar_rect); // should remain unset!
VERIFY(!m_have_taskbar_rect); // should remain unset!
return IterationDecision::Break;
};
return IterationDecision::Continue;
@ -421,7 +421,7 @@ void Window::set_resizable(bool resizable)
void Window::event(Core::Event& event)
{
if (!m_client) {
ASSERT(parent());
VERIFY(parent());
event.ignore();
return;
}
@ -721,7 +721,7 @@ void Window::set_fullscreen(bool fullscreen)
Gfx::IntRect Window::tiled_rect(WindowTileType tiled) const
{
ASSERT(tiled != WindowTileType::None);
VERIFY(tiled != WindowTileType::None);
int frame_width = (m_frame.rect().width() - m_rect.width()) / 2;
int title_bar_height = m_frame.title_bar_rect().height();
@ -770,7 +770,7 @@ Gfx::IntRect Window::tiled_rect(WindowTileType tiled) const
Screen::the().width() / 2 - frame_width,
(max_height - title_bar_height) / 2);
default:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}
@ -778,7 +778,7 @@ bool Window::set_untiled(Optional<Gfx::IntPoint> fixed_point)
{
if (m_tiled == WindowTileType::None)
return false;
ASSERT(!resize_aspect_ratio().has_value());
VERIFY(!resize_aspect_ratio().has_value());
m_tiled = WindowTileType::None;
@ -797,7 +797,7 @@ bool Window::set_untiled(Optional<Gfx::IntPoint> fixed_point)
void Window::set_tiled(WindowTileType tiled)
{
ASSERT(tiled != WindowTileType::None);
VERIFY(tiled != WindowTileType::None);
if (m_tiled == tiled)
return;
@ -851,7 +851,7 @@ void Window::add_accessory_window(Window& accessory_window)
void Window::set_parent_window(Window& parent_window)
{
ASSERT(!m_parent_window);
VERIFY(!m_parent_window);
m_parent_window = parent_window;
if (m_accessory)
parent_window.add_accessory_window(*this);

View file

@ -232,7 +232,7 @@ bool WindowFrame::frame_has_alpha() const
void WindowFrame::did_set_maximized(Badge<Window>, bool maximized)
{
ASSERT(m_maximize_button);
VERIFY(m_maximize_button);
m_maximize_button->set_icon(maximized ? *s_restore_icon : *s_maximize_icon);
}
@ -427,7 +427,7 @@ void WindowFrame::render_to_cache()
if (m_top_bottom && top_bottom_height > 0) {
m_bottom_y = window_rect.y() - total_frame_rect.y();
ASSERT(m_bottom_y >= 0);
VERIFY(m_bottom_y >= 0);
Gfx::Painter top_bottom_painter(*m_top_bottom);
top_bottom_painter.add_clip_rect({ update_location, { frame_rect_to_update.width(), top_bottom_height - update_location.y() - (total_frame_rect.bottom() - frame_rect_to_update.bottom()) } });
@ -441,7 +441,7 @@ void WindowFrame::render_to_cache()
if (left_right_width > 0) {
m_right_x = window_rect.x() - total_frame_rect.x();
ASSERT(m_right_x >= 0);
VERIFY(m_right_x >= 0);
Gfx::Painter left_right_painter(*m_left_right);
left_right_painter.add_clip_rect({ update_location, { left_right_width - update_location.x() - (total_frame_rect.right() - frame_rect_to_update.right()), window_rect.height() } });
@ -578,7 +578,7 @@ bool WindowFrame::hit_test(const Gfx::IntPoint& point) const
void WindowFrame::on_mouse_event(const MouseEvent& event)
{
ASSERT(!m_window.is_fullscreen());
VERIFY(!m_window.is_fullscreen());
auto& wm = WindowManager::the();
if (m_window.type() != WindowType::Normal && m_window.type() != WindowType::ToolWindow && m_window.type() != WindowType::Notification)
@ -657,7 +657,7 @@ void WindowFrame::on_mouse_event(const MouseEvent& event)
{ ResizeDirection::DownLeft, ResizeDirection::Down, ResizeDirection::DownRight },
};
Gfx::IntRect outer_rect = { {}, rect().size() };
ASSERT(outer_rect.contains(event.position()));
VERIFY(outer_rect.contains(event.position()));
int window_relative_x = event.x() - outer_rect.x();
int window_relative_y = event.y() - outer_rect.y();
int hot_area_row = min(2, window_relative_y / (outer_rect.height() / 3));
@ -675,7 +675,7 @@ void WindowFrame::start_flash_animation()
{
if (!m_flash_timer) {
m_flash_timer = Core::Timer::construct(100, [this] {
ASSERT(m_flash_counter);
VERIFY(m_flash_counter);
invalidate_title_bar();
if (!--m_flash_counter)
m_flash_timer->stop();
@ -717,7 +717,7 @@ void WindowFrame::paint_simple_rect_shadow(Gfx::Painter& painter, const Gfx::Int
}
// The containing_rect should have been inflated appropriately
ASSERT(containing_rect.size().contains(Gfx::IntSize { base_size, base_size }));
VERIFY(containing_rect.size().contains(Gfx::IntSize { base_size, base_size }));
auto sides_height = containing_rect.height() - 2 * base_size;
auto half_height = sides_height / 2;

View file

@ -58,7 +58,7 @@ static WindowManager* s_the;
WindowManager& WindowManager::the()
{
ASSERT(s_the);
VERIFY(s_the);
return *s_the;
}
@ -460,7 +460,7 @@ void WindowManager::start_window_resize(Window& window, const Gfx::IntPoint& pos
};
Gfx::IntRect outer_rect = window.frame().rect();
if (!outer_rect.contains(position)) {
// FIXME: This used to be an ASSERT but crashing WindowServer over this seems silly.
// FIXME: This used to be an VERIFY but crashing WindowServer over this seems silly.
dbgln("FIXME: !outer_rect.contains(position): outer_rect={}, position={}", outer_rect, position);
}
int window_relative_x = position.x() - outer_rect.x();
@ -469,7 +469,7 @@ void WindowManager::start_window_resize(Window& window, const Gfx::IntPoint& pos
int hot_area_column = min(2, window_relative_x / (outer_rect.width() / 3));
m_resize_direction = direction_for_hot_area[hot_area_row][hot_area_column];
if (m_resize_direction == ResizeDirection::None) {
ASSERT(!m_resize_window);
VERIFY(!m_resize_window);
return;
}
@ -644,7 +644,7 @@ bool WindowManager::process_ongoing_window_resize(const MouseEvent& event, Windo
change_h = diff_y;
break;
default:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
auto new_rect = m_resize_window_original_rect;
@ -692,7 +692,7 @@ bool WindowManager::process_ongoing_window_resize(const MouseEvent& event, Windo
new_rect.set_right_without_resize(m_resize_window_original_rect.right());
break;
default:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
if (new_rect.contains(event.position()))
@ -772,7 +772,7 @@ auto WindowManager::DoubleClickInfo::metadata_for_button(MouseButton button) con
case MouseButton::Forward:
return m_forward;
default:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}
@ -790,7 +790,7 @@ auto WindowManager::DoubleClickInfo::metadata_for_button(MouseButton button) ->
case MouseButton::Forward:
return m_forward;
default:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}
@ -816,7 +816,7 @@ void WindowManager::start_menu_doubleclick(Window& window, const MouseEvent& eve
// So, in order to be able to detect a double click when a menu is being
// opened by the MouseDown event, we need to consider the MouseDown event
// as a potential double-click trigger
ASSERT(event.type() == Event::MouseDown);
VERIFY(event.type() == Event::MouseDown);
auto& metadata = m_double_click_info.metadata_for_button(event.button());
if (&window != m_double_click_info.m_clicked_window) {
@ -835,7 +835,7 @@ void WindowManager::start_menu_doubleclick(Window& window, const MouseEvent& eve
bool WindowManager::is_menu_doubleclick(Window& window, const MouseEvent& event) const
{
ASSERT(event.type() == Event::MouseUp);
VERIFY(event.type() == Event::MouseUp);
if (&window != m_double_click_info.m_clicked_window)
return false;
@ -850,7 +850,7 @@ bool WindowManager::is_menu_doubleclick(Window& window, const MouseEvent& event)
void WindowManager::process_event_for_doubleclick(Window& window, MouseEvent& event)
{
// We only care about button presses (because otherwise it's not a doubleclick, duh!)
ASSERT(event.type() == Event::MouseUp);
VERIFY(event.type() == Event::MouseUp);
if (&window != m_double_click_info.m_clicked_window) {
// we either haven't clicked anywhere, or we haven't clicked on this
@ -983,7 +983,7 @@ void WindowManager::process_mouse_event(MouseEvent& event, Window*& hovered_wind
return;
}
ASSERT(window.hit_test(event.position()));
VERIFY(window.hit_test(event.position()));
if (event.type() == Event::MouseDown) {
// We're clicking on something that's blocked by a modal window.
// Flash the modal window to let the user know about it.
@ -1131,7 +1131,7 @@ Gfx::IntRect WindowManager::arena_rect_for_type(WindowType type) const
case WindowType::Notification:
return Screen::the().rect();
default:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}
@ -1310,8 +1310,8 @@ void WindowManager::set_active_window(Window* window, bool make_input)
{
if (window) {
if (auto* modal_window = window->blocking_modal_window()) {
ASSERT(modal_window->is_modal());
ASSERT(modal_window != window);
VERIFY(modal_window->is_modal());
VERIFY(modal_window != window);
window = modal_window;
make_input = true;
}
@ -1473,7 +1473,7 @@ Gfx::IntRect WindowManager::maximized_window_rect(const Window& window) const
void WindowManager::start_dnd_drag(ClientConnection& client, const String& text, const Gfx::Bitmap* bitmap, const Core::MimeData& mime_data)
{
ASSERT(!m_dnd_client);
VERIFY(!m_dnd_client);
m_dnd_client = client;
m_dnd_text = text;
m_dnd_bitmap = bitmap;
@ -1484,7 +1484,7 @@ void WindowManager::start_dnd_drag(ClientConnection& client, const String& text,
void WindowManager::end_dnd_drag()
{
ASSERT(m_dnd_client);
VERIFY(m_dnd_client);
Compositor::the().invalidate_cursor();
m_dnd_client = nullptr;
m_dnd_text = {};

View file

@ -39,7 +39,7 @@ static WindowSwitcher* s_the;
WindowSwitcher& WindowSwitcher::the()
{
ASSERT(s_the);
VERIFY(s_the);
return *s_the;
}
@ -124,7 +124,7 @@ void WindowSwitcher::on_key_event(const KeyEvent& event)
hide();
return;
}
ASSERT(!m_windows.is_empty());
VERIFY(!m_windows.is_empty());
int new_selected_index;
@ -135,7 +135,7 @@ void WindowSwitcher::on_key_event(const KeyEvent& event)
if (new_selected_index < 0)
new_selected_index = static_cast<int>(m_windows.size()) - 1;
}
ASSERT(new_selected_index < static_cast<int>(m_windows.size()));
VERIFY(new_selected_index < static_cast<int>(m_windows.size()));
select_window_at_index(new_selected_index);
}
@ -154,7 +154,7 @@ void WindowSwitcher::select_window_at_index(int index)
{
m_selected_index = index;
auto* highlight_window = m_windows.at(index).ptr();
ASSERT(highlight_window);
VERIFY(highlight_window);
WindowManager::the().set_highlight_window(highlight_window);
redraw();
}

View file

@ -77,7 +77,7 @@ int main(int, char**)
auto theme_name = wm_config->read_entry("Theme", "Name", "Default");
auto theme = Gfx::load_system_theme(String::formatted("/res/themes/{}.ini", theme_name));
ASSERT(theme.is_valid());
VERIFY(theme.is_valid());
Gfx::set_system_theme(theme);
auto palette = Gfx::PaletteImpl::create_with_anonymous_buffer(theme);
@ -114,5 +114,5 @@ int main(int, char**)
dbgln("Entering WindowServer main loop");
loop.exec();
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}