mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-15 12:40:12 +00:00
Fix running UI tests on beta branch
This commit is contained in:
parent
9ee6f99588
commit
7a3fb9c2ac
src/ui
@ -26,10 +26,12 @@ Display::Display(Display* parentDisplay,
|
||||
, m_nativeWindow(nativeWindow)
|
||||
, m_containedWidget(containedWidget)
|
||||
{
|
||||
#if 0 // When compiling tests all these values can be nullptr
|
||||
ASSERT(m_nativeWindow);
|
||||
ASSERT(m_containedWidget);
|
||||
ASSERT(m_containedWidget->type() == kManagerWidget ||
|
||||
m_containedWidget->type() == kWindowWidget);
|
||||
#endif
|
||||
m_dirtyRegion = bounds();
|
||||
}
|
||||
|
||||
@ -40,7 +42,10 @@ os::Surface* Display::surface() const
|
||||
|
||||
gfx::Size Display::size() const
|
||||
{
|
||||
ASSERT(m_nativeWindow);
|
||||
// When running tests this can be nullptr
|
||||
if (!m_nativeWindow)
|
||||
return gfx::Size(1, 1);
|
||||
|
||||
const int scale = m_nativeWindow->scale();
|
||||
ASSERT(scale > 0);
|
||||
return gfx::Size(m_nativeWindow->width() / scale,
|
||||
|
@ -181,7 +181,9 @@ Manager::Manager(const os::WindowRef& nativeWindow)
|
||||
, m_lockedWindow(nullptr)
|
||||
, m_mouseButton(kButtonNone)
|
||||
{
|
||||
nativeWindow->setUserData(&m_display);
|
||||
// The native window can be nullptr when running tests
|
||||
if (nativeWindow)
|
||||
nativeWindow->setUserData(&m_display);
|
||||
|
||||
#ifdef DEBUG_UI_THREADS
|
||||
ASSERT(!manager_thread);
|
||||
@ -1658,6 +1660,10 @@ void Manager::onNewDisplayConfiguration(Display* display)
|
||||
container->setBounds(gfx::Rect(displaySize));
|
||||
}
|
||||
|
||||
// The native window can be nullptr when running tests.
|
||||
if (!display->nativeWindow())
|
||||
return;
|
||||
|
||||
_internal_set_mouse_display(display);
|
||||
container->invalidate();
|
||||
container->flushRedraw();
|
||||
|
Loading…
x
Reference in New Issue
Block a user