VirtualBox

Changeset 101444 in vbox


Ignore:
Timestamp:
Oct 13, 2023 6:16:24 PM (18 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
159503
Message:

ValKit: Simple algorithm for basic screenshot validation of a Windows VM (fix for Python 2)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/tests/additions/tdAddGuestCtrl.py

    r101416 r101444  
    55005500        iThreshold = 20
    55015501        for i in range(0, cPixels, 4) :
    5502             iRed = int(aRGBData[i])
    5503             iGreen = int(aRGBData[i + 1])
    5504             iBlue = int(aRGBData[i + 2])
     5502            if sys.version_info[0] >= 3:
     5503                iRed   = aRGBData[i];
     5504                iGreen = aRGBData[i + 1];
     5505                iBlue  = aRGBData[i + 2];
     5506            else: # Python 2.7 treats a pixel data returned by takeScreenShotToArray as a string
     5507                iRed   = ord(aRGBData[i])
     5508                iGreen = ord(aRGBData[i + 1])
     5509                iBlue  = ord(aRGBData[i + 2])
     5510
    55055511            iBright = (3 * iRed + 6 * iGreen + iBlue) / 10
    55065512            if iThreshold < iBright < 255 - iThreshold :
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette