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