code: def resizeWindow(win, w, h, timeout=2.0):
      """Resize a window and wait until it has the correct size.
  
      This is required for unit testing on some platforms that do not guarantee
      immediate response from the windowing system.
      """
      QtWidgets.QApplication.processEvents()
      # Sometimes the window size will switch multiple times before settling
      # on its final size. Adding qWaitForWindowExposed seems to help with this.
      QtTest.QTest.qWaitForWindowExposed(win)
      win.resize(w, h)
      start = time.time()
      while True:
          w1, h1 = win.width(), win.height()
          if (w, h) == (w1, h1):
              return
          QtTest.QTest.qWait(10)
          if time.time() - start > timeout:
              raise TimeoutError(
                  "Window resize failed (requested %dx%d, got %dx%d)"
                  % (w, h, w1, h1)
              )
  
file_path: pyqtgraph/tests/ui_testing.py
imports: import time
  from pyqtgraph.Qt import QtCore, QtGui, QtTest, QtWidgets
label_desc: Use image node_id 1 for calling a global function with example usage: resizeWindow(win, w, h, timeout) without return types