rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
if sys.getfilesystemencoding() == 'UTF-8' and isinstance(file,unicode): filename = os.path.splitext(os.path.basename(file))[0] else: filename = os.path.splitext(os.path.basename(file))[0].decode(sys.getfilesystemencoding())
if sys.platform == 'win32': encoding = "UTF-8" else: encoding = sys.getfilesystemencoding() if encoding == 'UTF-8' and isinstance(file,unicode): filename = os.path.splitext(os.path.basename(file))[0] else: filename = os.path.splitext(os.path.basename(file))[0].decode(encoding)
def read(self,file,codec): import swatchbook.codecs as codecs if self.test(file,codec): eval('codecs.'+self.test(file,codec)).read(self,file) if sys.getfilesystemencoding() == 'UTF-8' and isinstance(file,unicode): filename = os.path.splitext(os.path.basename(file))[0] else: filename = os.path.splitext(os.path.basename(file))[0].decode(sys.getfilesystemencoding()) if 'name' not in self.info: self.info['name'] = {0: filename.replace('_',' ')} else: raise FileFormatError,file+': unsupported file'
c135f8eb45b7dac8b958f99a730f0dcbb02b8bd4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9936/c135f8eb45b7dac8b958f99a730f0dcbb02b8bd4/__init__.py
cprt = self.info['tags']['cprt'] self.info['cprt'] = self.readfield(file,cprt[1],cprt[0]) desc = self.info['tags']['desc'] self.info['desc'] = self.readfield(file,desc[1],desc[0])
try: cprt = self.info['tags']['cprt'] self.info['cprt'] = self.readfield(file,cprt[1],cprt[0]) desc = self.info['tags']['desc'] self.info['desc'] = self.readfield(file,desc[1],desc[0]) except KeyError: raise BadICCprofile, "That file misses one mandatory tag"
def __init__(self,uri): if os.path.getsize(uri) < 128: raise BadICCprofile, "That file doesn't seem to be an ICC color profile" else: file = open(uri,'rb') self.uri = uri file.seek(0) size,cmm = struct.unpack('>L 4s',file.read(8)) # Profile size if os.path.getsize(uri) != size: raise BadICCprofile, "That file doesn't have the expected size" if not (all(c in string.ascii_letters+' '+string.digits for c in cmm) or cmm == '\x00\x00\x00\x00'): raise BadICCprofile, "That file doesn't seem to be an ICC color profile" else: file.seek(8) version = struct.unpack('>B 1s 2s',file.read(4)) # Profile version number version1 = version[1].encode('hex') self.info = {} self.info['version'] = (version[0],eval('0x'+version1[0]),eval('0x'+version1[1])) self.info['class'] = struct.unpack('4s',file.read(4))[0] # Profile/Device Class self.info['space'] = struct.unpack('4s',file.read(4))[0] # Color space of data self.info['pcs'] = struct.unpack('4s',file.read(4))[0] # Profile Connection Space file.seek(128) tags = struct.unpack('>L',file.read(4))[0] self.info['tags'] = {} for i in range(tags): tag = struct.unpack('>4s 2L',file.read(12)) self.info['tags'][tag[0]] = (tag[1],tag[2])
448a875d1f62ee65f0957d815e1d64bc1f0e7933 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9936/448a875d1f62ee65f0957d815e1d64bc1f0e7933/icc.py
sbz.sitem.extra[xmlunescape(elem.attrib['type'])] = xmlunescape(elem.text)
sitem.extra[xmlunescape(elem.attrib['type'])] = xmlunescape(elem.text)
def readmaterial(material,swatchbook): if material.tag == 'color': sitem = Color(swatchbook) if 'usage' in material.attrib: sitem.usage = material.attrib['usage'].split(',') for elem in material: if elem.tag == 'values': values = map(eval,elem.text.split()) if 'space' in elem.attrib: sitem.values[(elem.attrib['model'],unicode(elem.attrib['space']))] = values else: sitem.values[(elem.attrib['model'],False)] = values elif elem.tag == 'metadata': sbz.readmeta(sitem,elem) elif elem.tag == 'extra': sbz.sitem.extra[xmlunescape(elem.attrib['type'])] = xmlunescape(elem.text) if sitem.info.identifier > '': id = sitem.info.identifier else: raise FileFormatError swatchbook.materials[id] = sitem
3bfb73ea36d7f8dc803b43c6bd361d7ecef0e6f4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9936/3bfb73ea36d7f8dc803b43c6bd361d7ecef0e6f4/sbz.py
def run(self): for lang in os.listdir('build/locale/'): lang_dir = os.path.join('share', 'locale', lang, 'LC_MESSAGES') lang_file = os.path.join('build', 'locale', lang, 'LC_MESSAGES', 'swatchbooker.mo') self.data_files.append( (lang_dir, [lang_file]) ) _install_data.run(self)
99b1ae36055f3eb6c75002c5aaf564c9bc9aa4c7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9936/99b1ae36055f3eb6c75002c5aaf564c9bc9aa4c7/setup.py
version='0.7',
version='0.7.1',
def run(self): for lang in os.listdir('build/locale/'): lang_dir = os.path.join('share', 'locale', lang, 'LC_MESSAGES') lang_file = os.path.join('build', 'locale', lang, 'LC_MESSAGES', 'swatchbooker.mo') self.data_files.append( (lang_dir, [lang_file]) ) _install_data.run(self)
99b1ae36055f3eb6c75002c5aaf564c9bc9aa4c7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9936/99b1ae36055f3eb6c75002c5aaf564c9bc9aa4c7/setup.py
scripts=['data/swatchbooker', 'data/sbconvertor','data/sbconvert'],
def run(self): for lang in os.listdir('build/locale/'): lang_dir = os.path.join('share', 'locale', lang, 'LC_MESSAGES') lang_file = os.path.join('build', 'locale', lang, 'LC_MESSAGES', 'swatchbooker.mo') self.data_files.append( (lang_dir, [lang_file]) ) _install_data.run(self)
99b1ae36055f3eb6c75002c5aaf564c9bc9aa4c7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9936/99b1ae36055f3eb6c75002c5aaf564c9bc9aa4c7/setup.py
('lib/swatchbooker', ['src/swatchbooker.pyw', 'src/sbconvertor.pyw','src/sbconvert.py'])],
('lib/swatchbooker', ['src/swatchbooker.pyw', 'src/sbconvertor.pyw','src/sbconvert.py','src/sbcommon.py']), ('bin',['data/swatchbooker', 'data/sbconvertor','data/sbconvert'])],
def run(self): for lang in os.listdir('build/locale/'): lang_dir = os.path.join('share', 'locale', lang, 'LC_MESSAGES') lang_file = os.path.join('build', 'locale', lang, 'LC_MESSAGES', 'swatchbooker.mo') self.data_files.append( (lang_dir, [lang_file]) ) _install_data.run(self)
99b1ae36055f3eb6c75002c5aaf564c9bc9aa4c7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9936/99b1ae36055f3eb6c75002c5aaf564c9bc9aa4c7/setup.py
elif elem.tag == '{'+dcterms+'}license': item.info.license = xmlunescape(elem.attrib['{'+rdf+'}resource'])
def readmeta(item,meta): for elem in meta: if elem.tag.find(dc): if elem.tag == '{'+dc+'}date': try: item.info.date = datetime.strptime(elem.text,"%Y-%m-%dT%H:%M:%S.%f") except ValueError, e: if str(e) == "'f' is a bad directive in format '%Y-%m-%dT%H:%M:%S.%f'": # Python 2.5 item.info.date = datetime.strptime(elem.text.split('.')[0],"%Y-%m-%dT%H:%M:%S") else: remain = str(e)[26:] if remain == 'Z': item.info.date = datetime.strptime(elem.text[:-len(remain)],"%Y-%m-%dT%H:%M:%S.%f") else: date = datetime.strptime(elem.text[:-len(remain)],"%Y-%m-%dT%H:%M:%S.%f") delta = remain.split(':') item.info.date = date - timedelta(hours=int(delta[0]),minutes=int(delta[1])) elif elem.tag == '{'+dc+'}type': if elem.attrib['{'+rdf+'}resource'] != 'http://purl.org/dc/dcmitype/Dataset': raise FileFormatError elif elem.tag == '{'+dc+'}format': if elem.text != 'application/swatchbook': raise FileFormatError elif '{'+xml+'}lang' in elem.attrib: exec("item.info."+elem.tag[(len(dc)+2):]+"_l10n[elem.attrib['{'+xml+'}lang']] = xmlunescape(elem.text)") else: exec("item.info."+elem.tag[(len(dc)+2):]+" = xmlunescape(elem.text)") elif elem.tag == '{'+dcterms+'}license': item.info.license = xmlunescape(elem.attrib['{'+rdf+'}resource'])
d91926c0cb576bdece80d328b311ac454f94580d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9936/d91926c0cb576bdece80d328b311ac454f94580d/sbz.py
posX = rootNode.size.x-50 posY = rootNode.size.y-50
posX = rootNode.size.x * 3/4 posY = rootNode.size.y-40
def __init__(self): rootNode = Player.getRootNode() posX = rootNode.size.x-50 posY = rootNode.size.y-50 self.__layer = Player.createNode(''' <words id="displayEmu" x="%(posX)i" y="%(posY)i" fontsize="20" opacity="1" alignment="right" color="DDDDDD" text="Multitouch emulation active" sensitive="False" /> ''' % {'posX':posX, 'posY':posY} ) rootNode.appendChild(self.__layer) self.__container = Player.createNode('div', {}) self.__p1 = Player.createNode('circle', {'r': 10, 'fillcolor':'ff0000', 'fillopacity':0, 'opacity':0, 'sensitive':False}) self.__p2 = Player.createNode('circle', {'r': 10, 'fillcolor':'ff0000', 'fillopacity':0, 'opacity':0, 'sensitive':False})
2d04ac491f6f761c0db24ccc6820b358ca18e58f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/2d04ac491f6f761c0db24ccc6820b358ca18e58f/mtemu.py
<words id="displayEmu" x="%(posX)i" y="%(posY)i" fontsize="20" opacity="1" alignment="right"
<words id="displayEmu" x="%(posX)i" y="%(posY)i" fontsize="20" opacity="1"
def __init__(self): rootNode = Player.getRootNode() posX = rootNode.size.x-50 posY = rootNode.size.y-50 self.__layer = Player.createNode(''' <words id="displayEmu" x="%(posX)i" y="%(posY)i" fontsize="20" opacity="1" alignment="right" color="DDDDDD" text="Multitouch emulation active" sensitive="False" /> ''' % {'posX':posX, 'posY':posY} ) rootNode.appendChild(self.__layer) self.__container = Player.createNode('div', {}) self.__p1 = Player.createNode('circle', {'r': 10, 'fillcolor':'ff0000', 'fillopacity':0, 'opacity':0, 'sensitive':False}) self.__p2 = Player.createNode('circle', {'r': 10, 'fillcolor':'ff0000', 'fillopacity':0, 'opacity':0, 'sensitive':False})
2d04ac491f6f761c0db24ccc6820b358ca18e58f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/2d04ac491f6f761c0db24ccc6820b358ca18e58f/mtemu.py
def __init__(self): rootNode = Player.getRootNode() posX = rootNode.size.x-50 posY = rootNode.size.y-50 self.__layer = Player.createNode(''' <words id="displayEmu" x="%(posX)i" y="%(posY)i" fontsize="20" opacity="1" alignment="right" color="DDDDDD" text="Multitouch emulation active" sensitive="False" /> ''' % {'posX':posX, 'posY':posY} ) rootNode.appendChild(self.__layer) self.__container = Player.createNode('div', {}) self.__p1 = Player.createNode('circle', {'r': 10, 'fillcolor':'ff0000', 'fillopacity':0, 'opacity':0, 'sensitive':False}) self.__p2 = Player.createNode('circle', {'r': 10, 'fillcolor':'ff0000', 'fillopacity':0, 'opacity':0, 'sensitive':False})
2d04ac491f6f761c0db24ccc6820b358ca18e58f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/2d04ac491f6f761c0db24ccc6820b358ca18e58f/mtemu.py
if self.pos1 != (-1,-1) and self.pos2 != (-1,-1): Player.getTestHelper().fakeTouchEvent(self.__getLeftID(), avg.CURSORUP, self.EventMode, self.pos1, self.pos1, Point2D(0,0)) Player.getTestHelper().fakeTouchEvent(self.__getRightID(), avg.CURSORUP, self.EventMode, self.pos2, self.pos2, Point2D(0,0))
Player.getTestHelper().fakeTouchEvent(self.__getLeftID(), avg.CURSORUP, self.EventMode, self.pos1, self.pos1, Point2D(0,0)) Player.getTestHelper().fakeTouchEvent(self.__getRightID(), avg.CURSORUP, self.EventMode, self.pos2, self.pos2, Point2D(0,0))
def delete(self): """ after turning off the emulater the function unlinks all nodes of the emulator. so it be garanted that the application is working as before again. events will be cleared with two UP events. """ rootNode = Player.getRootNode() rootNode.setEventHandler(avg.CURSORMOTION, avg.MOUSE, None) rootNode.setEventHandler(avg.CURSORDOWN, avg.MOUSE, None) rootNode.setEventHandler(avg.CURSORUP, avg.MOUSE, None) self.__layer.unlink() self.__container.unlink() self.__p1.unlink() self.__p2.unlink() self.__p1 = self.__p2 = None self.__container = self.__node2root = self.__layer = None if self.pos1 != (-1,-1) and self.pos2 != (-1,-1): Player.getTestHelper().fakeTouchEvent(self.__getLeftID(), avg.CURSORUP, self.EventMode, self.pos1, self.pos1, Point2D(0,0)) Player.getTestHelper().fakeTouchEvent(self.__getRightID(), avg.CURSORUP, self.EventMode, self.pos2, self.pos2, Point2D(0,0))
2d04ac491f6f761c0db24ccc6820b358ca18e58f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/2d04ac491f6f761c0db24ccc6820b358ca18e58f/mtemu.py
def __clampPos(self, pos): if pos[0] < 0: pos[0] = 0 if pos[1] < 0: pos[1] = 0 if pos[0] > Player.getRootNode().size[0]-1: pos[0] = Player.getRootNode().size[0]-1 if pos[1] > Player.getRootNode().size[1]-1: pos[1] = Player.getRootNode().size[0]-1 return pos
def __getRightID(self): self.idpos2 = int(self.ID.y) return self.idpos2
2d04ac491f6f761c0db24ccc6820b358ca18e58f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/2d04ac491f6f761c0db24ccc6820b358ca18e58f/mtemu.py
self.pos1 = (-1,-1) self.mouseDown1 = (-1,-1) if self.multiActive:
if self.multiActive: self.pos2 = self.__clampPos(self.pos2)
def __onMouseButtonUp(self, e): #one or two fake UP events will be created (multitouch active or not). #SOURCE depending on EventMode. self.__eraseDraw() if e.button == 1: self.mouseState = 'Up' Player.getTestHelper().fakeTouchEvent(self.__getLeftID(), avg.CURSORUP, self.EventMode, self.pos1, self.pos1, e.speed) self.pos1 = (-1,-1) self.mouseDown1 = (-1,-1)
2d04ac491f6f761c0db24ccc6820b358ca18e58f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/2d04ac491f6f761c0db24ccc6820b358ca18e58f/mtemu.py
self.pos2 = (-1,-1) self.mouseDown2 = (-1,-1)
def __onMouseButtonUp(self, e): #one or two fake UP events will be created (multitouch active or not). #SOURCE depending on EventMode. self.__eraseDraw() if e.button == 1: self.mouseState = 'Up' Player.getTestHelper().fakeTouchEvent(self.__getLeftID(), avg.CURSORUP, self.EventMode, self.pos1, self.pos1, e.speed) self.pos1 = (-1,-1) self.mouseDown1 = (-1,-1)
2d04ac491f6f761c0db24ccc6820b358ca18e58f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/2d04ac491f6f761c0db24ccc6820b358ca18e58f/mtemu.py
self.start(None, (startAnim,
self.start(None, (startFireForgetAnim, lambda: self.assert_(avg.getNumRunningAnims() == 2), None, startAnim,
def deleteAnim(): self.anim = None
25433654ead5e7cb0e330d27e2eb89812447ed8d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/25433654ead5e7cb0e330d27e2eb89812447ed8d/AnimTest.py
startAnim, deleteAnim, lambda: self.assert_(avg.getNumRunningAnims() == 0),
startAnim
def deleteAnim(): self.anim = None
25433654ead5e7cb0e330d27e2eb89812447ed8d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/25433654ead5e7cb0e330d27e2eb89812447ed8d/AnimTest.py
self.node.href=href
self.node.href = href
def changeHRef(href): self.node.href=href
296fbf81f84ac5f8dec4f403d1a4f887901a8155 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/296fbf81f84ac5f8dec4f403d1a4f887901a8155/OffscreenTest.py
lambda: self.assert_(self.mouseDownCalled and self.mainMouseDownCalled),
def noCaptureEvent(): self.mouseDownCalled = False self.mainMouseDownCalled = False self.img.releaseEventCapture()
a52b4e8e71b7c5a695a85bd612af2f52071502df /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/a52b4e8e71b7c5a695a85bd612af2f52071502df/EventTest.py
not(self.divMouseOverCalled) and
self.divMouseOverCalled and
def killNodeUnderCursor(): Parent = img1.getParent() Parent.removeChild(Parent.indexOf(img1))
a52b4e8e71b7c5a695a85bd612af2f52071502df /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/a52b4e8e71b7c5a695a85bd612af2f52071502df/EventTest.py
not(self.divMouseOutCalled) and
self.divMouseOutCalled and
def killNodeUnderCursor(): Parent = img1.getParent() Parent.removeChild(Parent.indexOf(img1))
a52b4e8e71b7c5a695a85bd612af2f52071502df /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/a52b4e8e71b7c5a695a85bd612af2f52071502df/EventTest.py
def __init__(self, upNode = None, downNode = None, disabledNode = None, pressHandler = None, clickHandler = None, **kwargs): libavg.DivNode.__init__(self, **kwargs) self.crop = False #self.elementoutlinecolor = 'FF0000' self.__upNode = upNode self.__downNode = downNode self.__disabledNode = disabledNode self.__defaultHandler = lambda event: None self.__customPressHandler = pressHandler if pressHandler else self.__defaultHandler self.__customClickHandler = clickHandler if clickHandler else self.__defaultHandler
e97d3494a26997a144978c27234b58816a2b12e8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/e97d3494a26997a144978c27234b58816a2b12e8/button.py
return self.__hasBitState(Button.STATE_DOWN)
return bool(self.__hasBitState(Button.STATE_DOWN))
def isChecked(self): return self.__hasBitState(Button.STATE_DOWN)
e97d3494a26997a144978c27234b58816a2b12e8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/e97d3494a26997a144978c27234b58816a2b12e8/button.py
def __setup(self): self.appendChild(self.__upNode) self.appendChild(self.__downNode)
e97d3494a26997a144978c27234b58816a2b12e8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/e97d3494a26997a144978c27234b58816a2b12e8/button.py
self.__customClickHandler(event)
def __releaseHandlerTemplateMethod(self, event): numberOfCapturedCursors = self.__getNumberOfCapturedCursors() numberOfOverCursors = len(self.__overCursorIds) if self.__isCursorCaptured(event.cursorid): self.__releaseCapturedCursor(event.cursorid)
e97d3494a26997a144978c27234b58816a2b12e8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/e97d3494a26997a144978c27234b58816a2b12e8/button.py
def testVideoEOFWhithZeroOpacity(self): def onEOF(): Player.stop() def onNoEOF(): self.assert_(False) self.loadEmptyScene() videoNode = libavg.VideoNode(href = "../video/testfiles/mpeg1-48x48.mpg") videoNode.opacity = 0 Player.get().getRootNode().appendChild(videoNode) videoNode.play() videoNode.setEOFCallback(onEOF) Player.setTimeout(10000, onNoEOF) Player.play()
def onNoEOF(): self.assert_(False)
4d46de16771df83a65db941b51a57429867a431b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/4d46de16771df83a65db941b51a57429867a431b/AVTest.py
self.assertException(Player.screenshot())
self.assertException(Player.screenshot)
def checkCanvasScreenshot(): bmp = offscreenCanvas.screenshot() self.compareBitmapToFile(bmp, "testOffscreenScreenshot", False)
23b8888744ad7c13b099776e36e9cc39954c384d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/23b8888744ad7c13b099776e36e9cc39954c384d/OffscreenTest.py
avg.RectNode(parent=root, pos=(48,0), size=(32, 128), fillopacity=1, fillcolor="808080")
avg.RectNode(parent=root, pos=(48,0), size=(32, 120), strokewidth=2, fillopacity=1, fillcolor="808080")
def createBaseCanvas(): return Player.loadCanvasString(""" <canvas id="testcanvas" width="64" height="64"> <image x="0" y="0" href="rgb24alpha-64x64.png"/> </canvas> """)
6610910eac475c748d0ac2554b4aea1c6e49054e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/6610910eac475c748d0ac2554b4aea1c6e49054e/OffscreenTest.py
sys.path += ['..']
sys.path.insert(0, '..')
def setSymlink(src, dest): if not os.path.exists(dest): os.symlink(src, dest) elif not os.path.islink(dest): raise RuntimeError( '%s exists as a file/directory. Please remove it to perform tests' % dest)
eb40fc0bf82d8a8f242505490bfbea8f2954e515 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/eb40fc0bf82d8a8f242505490bfbea8f2954e515/Test.py
<canvas id="testcanvas" width="160" height="120"> <image href="freidrehen.jpg"/> <image id="blend" x="0" y="0" opacity="0.6" href="rgb24-65x65.png"/> <image x="0" y="48" opacity="0.6" href="rgb24-65x65.png" blendmode="add"/> <image x="48" y="0" opacity="1" href="rgb24-65x65.png" blendmode="min"/> <image x="48" y="48" opacity="1" href="rgb24-65x65.png" blendmode="max"/>
<canvas id="testcanvas" width="64" height="64"> <image x="0" y="0" href="rgb24alpha-64x64.png"/>
def createBaseCanvas(): return Player.loadCanvasString(""" <canvas id="testcanvas" width="160" height="120"> <image href="freidrehen.jpg"/> <image id="blend" x="0" y="0" opacity="0.6" href="rgb24-65x65.png"/> <image x="0" y="48" opacity="0.6" href="rgb24-65x65.png" blendmode="add"/> <image x="48" y="0" opacity="1" href="rgb24-65x65.png" blendmode="min"/> <image x="48" y="48" opacity="1" href="rgb24-65x65.png" blendmode="max"/> </canvas> """)
f223cb68bcafde137d919950573a703ba84df107 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/f223cb68bcafde137d919950573a703ba84df107/OffscreenTest.py
avg.ImageNode(parent=Player.getRootNode(), href="freidrehen.jpg")
def createBaseCanvas(): return Player.loadCanvasString(""" <canvas id="testcanvas" width="160" height="120"> <image href="freidrehen.jpg"/> <image id="blend" x="0" y="0" opacity="0.6" href="rgb24-65x65.png"/> <image x="0" y="48" opacity="0.6" href="rgb24-65x65.png" blendmode="add"/> <image x="48" y="0" opacity="1" href="rgb24-65x65.png" blendmode="min"/> <image x="48" y="48" opacity="1" href="rgb24-65x65.png" blendmode="max"/> </canvas> """)
f223cb68bcafde137d919950573a703ba84df107 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/f223cb68bcafde137d919950573a703ba84df107/OffscreenTest.py
node = avg.ImageNode(parent=Player.getRootNode(), href="canvas:testcanvas")
root = Player.getRootNode() avg.RectNode(parent=root, pos=(48,0), size=(32, 128), fillopacity=1, fillcolor="808080") avg.ImageNode(parent=root, href="canvas:testcanvas") avg.ImageNode(parent=root, pos=(0,64), href="canvas:testcanvas", opacity=0.6) avg.ImageNode(parent=root, pos=(64,0), href="canvas:testcanvas", blendmode="add") avg.ImageNode(parent=root, pos=(64,64), href="canvas:testcanvas", opacity=0.6, blendmode="add")
def createBaseCanvas(): return Player.loadCanvasString(""" <canvas id="testcanvas" width="160" height="120"> <image href="freidrehen.jpg"/> <image id="blend" x="0" y="0" opacity="0.6" href="rgb24-65x65.png"/> <image x="0" y="48" opacity="0.6" href="rgb24-65x65.png" blendmode="add"/> <image x="48" y="0" opacity="1" href="rgb24-65x65.png" blendmode="min"/> <image x="48" y="48" opacity="1" href="rgb24-65x65.png" blendmode="max"/> </canvas> """)
f223cb68bcafde137d919950573a703ba84df107 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/f223cb68bcafde137d919950573a703ba84df107/OffscreenTest.py
for id, touchVis in self.__touchViss:
for id, touchVis in self.__touchViss.items():
def __switchShowMTEvents(self): self.__showMTEvents = not(self.__showMTEvents) if self.__showMTEvents: self.__oldEventHook = g_player.getEventHook() g_player.setEventHook(self.__showMTEventHook) else: g_player.setEventHook(self.__oldEventHook) for id, touchVis in self.__touchViss: touchVis.unlink(True) self.__touchViss = {}
c54cee01a069914e3fbf52d025e56410e8007bc7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/c54cee01a069914e3fbf52d025e56410e8007bc7/AVGAppStarter.py
if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH:
if (isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH and (event.type == avg.CURSORDOWN or event.type == avg.CURSORMOTION or event.type == avg.CURSORUP)): try: touchVis = self.__touchViss[event.cursorid] except KeyError: touchVis = TouchVisualization(event, parent=self.__touchVisOverlay) self.__touchViss[event.cursorid] = touchVis
def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False
c54cee01a069914e3fbf52d025e56410e8007bc7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/c54cee01a069914e3fbf52d025e56410e8007bc7/AVGAppStarter.py
self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay)
pass
def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False
c54cee01a069914e3fbf52d025e56410e8007bc7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/c54cee01a069914e3fbf52d025e56410e8007bc7/AVGAppStarter.py
self.__touchViss[event.cursorid].move(event)
touchVis.move(event)
def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False
c54cee01a069914e3fbf52d025e56410e8007bc7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/c54cee01a069914e3fbf52d025e56410e8007bc7/AVGAppStarter.py
self.__touchViss[event.cursorid].unlink(True)
touchVis.unlink(True)
def __showMTEventHook(self, event): if isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH: if event.type == avg.CURSORDOWN: self.__touchViss[event.cursorid] = TouchVisualization(event, parent=self.__touchVisOverlay) elif event.type == avg.CURSORMOTION: self.__touchViss[event.cursorid].move(event) elif event.type == avg.CURSORUP: self.__touchViss[event.cursorid].unlink(True) del self.__touchViss[event.cursorid] if self.__oldEventHook: return self.__oldEventHook() else: return False
c54cee01a069914e3fbf52d025e56410e8007bc7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/c54cee01a069914e3fbf52d025e56410e8007bc7/AVGAppStarter.py
node.text=u"blindtext1\u00A0blindtext2\u00Ablindtext3 "+ "blindtext4\u00A0lindtext\u00A0blindtext\u00A0"
node.text=(u"blindtext1\u00A0blindtext2\u00Ablindtext3 "+ u"blindtext4\u00A0blindtext\u00A0blindtext\u00A0")
def setNBSP(): node = Player.getElementByID("dynamictext") node.width=100 node.text=u"blindtext1\u00A0blindtext2\u00Ablindtext3 "+ "blindtext4\u00A0lindtext\u00A0blindtext\u00A0"
8e2394e01d055683bfb06c7dfd89ddcf749c1b15 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/8e2394e01d055683bfb06c7dfd89ddcf749c1b15/WordsTest.py
) )
)) def testChangeParentError(self): def changeParent(): div = avg.DivNode() img = avg.ImageNode(href="additive/rgb24-64x64.png", parent=div) Player.getRootNode().appendChild(img) self.loadEmptyScene() self.assertException(changeParent) self.start(None, (self.assertException(changeParent), ))
def testDuplicateID(self): self.loadEmptyScene() root = Player.getRootNode() avg.ImageNode(href="rgb24-64x64.png", id="testdup", parent=root) self.assertException(lambda: avg.ImageNode(href="rgb24-64x64.png", id="testdup", parent=root)) self.start(None, (self.assertException(lambda: avg.ImageNode(href="rgb24-64x64.png", id="testdup", parent=root)), ) )
8de10b711c3293e60e41fc4df5200ea8990331be /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/8de10b711c3293e60e41fc4df5200ea8990331be/DynamicsTest.py
node = avg.VideoNode(href="../video/testfiles/mpeg1-48x48.mpg")
node = avg.VideoNode(href="../video/testfiles/mpeg1-48x48.mpg", threaded=False)
def testPlayBeforeConnect(self): node = avg.VideoNode(href="../video/testfiles/mpeg1-48x48.mpg") node.play() self._loadEmpty() Player.getRootNode().insertChild(node, 0) Player.setFakeFPS(25) self.start(None, (lambda: self.assert_(node.size == (48, 48)), lambda: self.compareImage("testPlayBeforeConnect", False), ))
d983e2d35a10094591acf76114123dd4e8411393 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/d983e2d35a10094591acf76114123dd4e8411393/AVTest.py
not(self.__mainDownCalled)),
self.__mainDownCalled),
def setPos(): self.node.pos = (80, 60) self.node.size = (80, 60)
b2b94b9a895fea972fa1ad61b64a7adcc8b5b25c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/b2b94b9a895fea972fa1ad61b64a7adcc8b5b25c/OffscreenTest.py
def __showMTEventHook(self, event): if (isinstance(event, avg.TouchEvent) and event.source == avg.TOUCH and (event.type == avg.CURSORDOWN or event.type == avg.CURSORMOTION or event.type == avg.CURSORUP)): try: touchVis = self.__touchViss[event.cursorid] except KeyError: touchVis = TouchVisualization(event, parent=self.__touchVisOverlay) self.__touchViss[event.cursorid] = touchVis if event.type == avg.CURSORDOWN: pass elif event.type == avg.CURSORMOTION: touchVis.move(event) elif event.type == avg.CURSORUP: touchVis.unlink(True) del self.__touchViss[event.cursorid]
c69880f7c090e1d58832e9a71cef2b64c7d5e978 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/c69880f7c090e1d58832e9a71cef2b64c7d5e978/AVGAppStarter.py
def __createOffscreenCanvas():
def createOffscreenCanvas():
def __createOffscreenCanvas(): offscreenCanvas = self.__createOffscreenCanvas("offscreencanvas", False) self.node = avg.ImageNode(parent=Player.getRootNode(), href="canvas:offscreencanvas")
68ccfeafab4b377d085fe23436b510a8d95ebda3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/68ccfeafab4b377d085fe23436b510a8d95ebda3/OffscreenTest.py
__createOffscreenCanvas,
createOffscreenCanvas,
def __createOffscreenCanvas(): offscreenCanvas = self.__createOffscreenCanvas("offscreencanvas", False) self.node = avg.ImageNode(parent=Player.getRootNode(), href="canvas:offscreencanvas")
68ccfeafab4b377d085fe23436b510a8d95ebda3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/68ccfeafab4b377d085fe23436b510a8d95ebda3/OffscreenTest.py
g_Player.clearTimeout(self.__inertiaHandlerID)
g_Player.clearInterval(self.__inertiaHandlerID)
def __onDown(self, event): if self.__dragCursorID == None: if self.__inertiaHandlerID: self.__stopHandler() g_Player.clearTimeout(self.__inertiaHandlerID) self.__dragCursorID = event.cursorid self.__dragStartPos = event.pos self.__node.setEventCapture(event.cursorid) if self.__startHandler: self.__startHandler(event) self.__speed = avg.Point2D(0,0) self.__frameHandlerID = g_Player.setOnFrameHandler(self.__onFrame)
3f46068610964b39d704af0fdca92147a7880436 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/3f46068610964b39d704af0fdca92147a7880436/manipulation.py
self.__node.x = self.__startDragPos[0]+event.x-event.lastdownpos[0] self.__node.y = self.__startDragPos[1]+event.y-event.lastdownpos[1]
self.__node.pos = (self.__startDragPos[0]+event.x-event.lastdownpos[0],self.__startDragPos[1]+event.y-event.lastdownpos[1])
def __onMove(self, event): if event.cursorid == self.__cursorID: self.__node.x = self.__startDragPos[0]+event.x-event.lastdownpos[0] self.__node.y = self.__startDragPos[1]+event.y-event.lastdownpos[1] stopBubble = False if self.__onDragMove: stopBubble = self.__onDragMove(event) if stopBubble == None: stopBubble = False return stopBubble
08d03676380c0236e98994118de1718693c0dd36 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/08d03676380c0236e98994118de1718693c0dd36/draggable.py
relTime = g_Player.getFrameTime() - self.__startTime
relTime = g_Player.getFrameTime() - self.__startTime - self.__holdDelay
def __onFrame(self): relTime = g_Player.getFrameTime() - self.__startTime if self.__state == HoldProcessor.DOWN: if relTime > self.__holdDelay: self.__changeState(HoldProcessor.HOLDING) if self.__state == HoldProcessor.HOLDING: if relTime > self.__activateDelay: self.__changeState(HoldProcessor.ACTIVE) else: self.__holdHandler(float(relTime)/self.__activateDelay)
b969b635def3d57083c9940a64e56e65a7fad331 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/b969b635def3d57083c9940a64e56e65a7fad331/manipulation.py
self.__holdHandler(float(relTime)/self.__activateDelay)
self.__holdHandler(float(relTime)/(self.__activateDelay-self.__holdDelay))
def __onFrame(self): relTime = g_Player.getFrameTime() - self.__startTime if self.__state == HoldProcessor.DOWN: if relTime > self.__holdDelay: self.__changeState(HoldProcessor.HOLDING) if self.__state == HoldProcessor.HOLDING: if relTime > self.__activateDelay: self.__changeState(HoldProcessor.ACTIVE) else: self.__holdHandler(float(relTime)/self.__activateDelay)
b969b635def3d57083c9940a64e56e65a7fad331 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/b969b635def3d57083c9940a64e56e65a7fad331/manipulation.py
self.__activateEventHandler()
self.__activateEventHandler()
def __init__(self, upNode = None, downNode = None, disabledNode = None, pressHandler = None, clickHandler = None, **kwargs): libavg.DivNode.__init__(self, **kwargs) self.crop = False self.__upNode = upNode self.__downNode = downNode self.__disabledNode = disabledNode self.__defaultHandler = lambda event: None self.__customPressHandler = pressHandler if pressHandler else self.__defaultHandler self.__customClickHandler = clickHandler if clickHandler else self.__defaultHandler
4f12752eeb90fd3a92002ac876daf3b76040a298 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/4f12752eeb90fd3a92002ac876daf3b76040a298/button.py
ratio = (self.__val/(self.__max-self.__min))
ratio = ((self.__val-self.__min)/(self.__max-self.__min))
def __positionSlider(self): if self.__val < self.__min: self.__val = self.__min elif self.__val > self.__max: self.__val = self.__max ratio = (self.__val/(self.__max-self.__min)) self.__slider.pos = (ratio*(self.size.x-14), 0) self.__onChange()
6df01f079231791029fc55931d63d6d00bdffda8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/6df01f079231791029fc55931d63d6d00bdffda8/avg_chromakey.py
print "Usage: videoplayer.py <filename>"
print "Usage: avg_videoplayer.py <filename>"
def __makeAlphaBackground(self): global node SQUARESIZE=40 size = node.getMediaSize() avg.RectNode(parent=self._parentNode, size=node.getMediaSize(), strokewidth=0, fillcolor="FFFFFF", fillopacity=1) for y in xrange(0, int(size.y)/SQUARESIZE): for x in xrange(0, int(size.x)/(SQUARESIZE*2)): pos = avg.Point2D(x*SQUARESIZE*2, y*SQUARESIZE) if y%2==1: pos += (SQUARESIZE, 0) avg.RectNode(parent=self._parentNode, pos=pos, size=(SQUARESIZE, SQUARESIZE), strokewidth=0, fillcolor="C0C0C0", fillopacity=1)
ddb67f1a908213273450d8c9acd3f8f38f64d45b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/ddb67f1a908213273450d8c9acd3f8f38f64d45b/avg_videoplayer.py
def testCanvasAlpha(self): mainCanvas = self.loadEmptyScene() canvas = Player.loadCanvasString(""" <canvas id="testcanvas" width="80" height="120"> <image id="test1" href="rgb24alpha-64x64.png"/> </canvas> """) avg.RectNode(parent=Player.getRootNode(), fillcolor="FFFFFF", pos=(0.5, 0.5), size=(160, 48), fillopacity=1) node = avg.ImageNode(parent=Player.getRootNode(), href="canvas:testcanvas") avg.ImageNode(parent=Player.getRootNode(), x=64, href="rgb24alpha-64x64.png") self.start(None, (lambda: self.compareImage("testCanvasAlpha", False), ))
902c6280ac080b5be6433f929773d4fc16d5dfe1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/902c6280ac080b5be6433f929773d4fc16d5dfe1/OffscreenTest.py
<canvas id="testcanvas" width="160" height="120" multisamplesamples="2">
<canvas id="testcanvas" width="160" height="120" multisamplesamples="2">
def createCanvas(): if not(avg.OffscreenCanvas.isMultisampleSupported()): print print "Offscreen multisampling not supported - skipping test." Player.stop() return try: self.canvas = Player.loadCanvasString(""" <canvas id="testcanvas" width="160" height="120" multisamplesamples="2"> <image id="test1" href="rgb24-65x65.png" angle="0.1"/> </canvas> """) except RuntimeError: print print "Offscreen multisampling init failed - skipping test." Player.stop() return self.assert_(self.canvas.multisamplesamples == 2) node = avg.ImageNode(parent=Player.getRootNode(), href="canvas:testcanvas")
902c6280ac080b5be6433f929773d4fc16d5dfe1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/902c6280ac080b5be6433f929773d4fc16d5dfe1/OffscreenTest.py
self.start(None, (lambda: videoNode.play(),
videoNode.play() seek(26) self.start(None, (lambda: self.compareImage("testVideoSeek0", False),
def seek(frame): videoNode.seekToFrame(frame)
269e7be164fa8d6b8e2c2b9f05f5d1f47c1fd5c2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/269e7be164fa8d6b8e2c2b9f05f5d1f47c1fd5c2/AVTest.py
return True
return False
def onKeyDown(self, event): global node curTime = node.getCurTime() if event.keystring == "right": node.seekToTime(curTime+10000) elif event.keystring == "left": if curTime > 10000: node.seekToTime(curTime-10000) else: node.seekToTime(0) return True
25df09f78cbb78a18d4efce8941906a9ad2e477d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/25df09f78cbb78a18d4efce8941906a9ad2e477d/avg_videoplayer.py
self.loadEmptyScene() root = Player.getRootNode() node = avg.ImageNode(parent=root, href="rgb24-64x64.png") effect = avg.BlurFXNode() node.setEffect(effect)
def removeFX(): self.node.setEffect(None) def reAddFX(): self.node.setEffect(self.effect) def addNewFX(): effect = avg.BlurFXNode() effect.setParam(8) self.node.setEffect(effect) self.loadEmptyScene() root = Player.getRootNode() self.node = avg.ImageNode(parent=root, href="rgb24-64x64.png") self.effect = avg.BlurFXNode() self.node.setEffect(self.effect)
def testBlurFX(self): self.loadEmptyScene() root = Player.getRootNode() node = avg.ImageNode(parent=root, href="rgb24-64x64.png") effect = avg.BlurFXNode() node.setEffect(effect) self.start(None, (lambda: self.compareImage("testBlurFX1", False), lambda: effect.setParam(8), lambda: self.compareImage("testBlurFX2", False), ))
c779904865a285c09327ebc847612f58a06d9fcd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/c779904865a285c09327ebc847612f58a06d9fcd/FXTest.py
lambda: effect.setParam(8),
lambda: self.effect.setParam(8), lambda: self.compareImage("testBlurFX2", False), removeFX, lambda: self.compareImage("testBlurFX3", False), reAddFX, lambda: self.compareImage("testBlurFX2", False), removeFX, addNewFX,
def testBlurFX(self): self.loadEmptyScene() root = Player.getRootNode() node = avg.ImageNode(parent=root, href="rgb24-64x64.png") effect = avg.BlurFXNode() node.setEffect(effect) self.start(None, (lambda: self.compareImage("testBlurFX1", False), lambda: effect.setParam(8), lambda: self.compareImage("testBlurFX2", False), ))
c779904865a285c09327ebc847612f58a06d9fcd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/c779904865a285c09327ebc847612f58a06d9fcd/FXTest.py
posX = rootNode.size.x * 3/4 posY = rootNode.size.y-40
posX = rootNode.size.x-50 posY = rootNode.size.y-50
def __init__(self): rootNode = Player.getRootNode() posX = rootNode.size.x * 3/4 posY = rootNode.size.y-40 self.__layer = Player.createNode(''' <words id="displayEmu" x="%(posX)i" y="%(posY)i" fontsize="20" opacity="1" color="DDDDDD" text="Multitouch emulation active" sensitive="False" /> ''' % {'posX':posX, 'posY':posY} ) rootNode.appendChild(self.__layer) self.__container = Player.createNode('div', {}) self.__p1 = Player.createNode('circle', {'r': 10, 'fillcolor':'ff0000', 'fillopacity':0, 'opacity':0, 'sensitive':False}) self.__p2 = Player.createNode('circle', {'r': 10, 'fillcolor':'ff0000', 'fillopacity':0, 'opacity':0, 'sensitive':False})
398a60d8227abde01ddf3c4cfaa558761e905599 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/398a60d8227abde01ddf3c4cfaa558761e905599/mtemu.py
<words id="displayEmu" x="%(posX)i" y="%(posY)i" fontsize="20" opacity="1"
<words id="displayEmu" x="%(posX)i" y="%(posY)i" fontsize="20" opacity="1" alignment="right"
def __init__(self): rootNode = Player.getRootNode() posX = rootNode.size.x * 3/4 posY = rootNode.size.y-40 self.__layer = Player.createNode(''' <words id="displayEmu" x="%(posX)i" y="%(posY)i" fontsize="20" opacity="1" color="DDDDDD" text="Multitouch emulation active" sensitive="False" /> ''' % {'posX':posX, 'posY':posY} ) rootNode.appendChild(self.__layer) self.__container = Player.createNode('div', {}) self.__p1 = Player.createNode('circle', {'r': 10, 'fillcolor':'ff0000', 'fillopacity':0, 'opacity':0, 'sensitive':False}) self.__p2 = Player.createNode('circle', {'r': 10, 'fillcolor':'ff0000', 'fillopacity':0, 'opacity':0, 'sensitive':False})
398a60d8227abde01ddf3c4cfaa558761e905599 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/398a60d8227abde01ddf3c4cfaa558761e905599/mtemu.py
self._getValue = getValue self._values = [] self._xSkip = 2 self._lastCurUsage = 0 self._maxFrameTime = 0
self._getValue = getValue self._xSkip = 2
def __init__(self, graph,getValue): self._getValue = getValue
5db631b9081e9af0ba5615613d6fbe26fed5b363 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/5db631b9081e9af0ba5615613d6fbe26fed5b363/AVGAppStarter.py
self._usage = [0] self._maxUsage = [0] self._minutesUsage = [0] self._minutesMaxUsage = [0]
def __init__(self, graph,getValue): self._getValue = getValue
5db631b9081e9af0ba5615613d6fbe26fed5b363 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/5db631b9081e9af0ba5615613d6fbe26fed5b363/AVGAppStarter.py
self._sampleNum = 0
def __init__(self, graph,getValue): self._getValue = getValue
5db631b9081e9af0ba5615613d6fbe26fed5b363 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/5db631b9081e9af0ba5615613d6fbe26fed5b363/AVGAppStarter.py
def kill(): self._node.unlink()
5db631b9081e9af0ba5615613d6fbe26fed5b363 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/5db631b9081e9af0ba5615613d6fbe26fed5b363/AVGAppStarter.py
self._memSampleNum = 0 self._usage = [0] self._maxUsage = [0] self._minutesUsage = [0] self._minutesMaxUsage = [0]
def _setup(self): self._interval = g_player.setInterval(1000, self._nextMemSample)
5db631b9081e9af0ba5615613d6fbe26fed5b363 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/5db631b9081e9af0ba5615613d6fbe26fed5b363/AVGAppStarter.py
+time.strftime("%H:%M:%S", time.localtime(lastMaxChangeTime)))
+time.strftime("%d.%m.%Y %H:%M:%S", time.localtime(lastMaxChangeTime)))
def _nextMemSample(self): curUsage = self._getValue() self._usage.append(curUsage) maxUsage = self._maxUsage[-1] if curUsage>maxUsage: maxUsage = curUsage lastMaxChangeTime = time.time() self._textNode1.text = ("Last increase in maximum: " +time.strftime("%H:%M:%S", time.localtime(lastMaxChangeTime))) self._maxUsage.append(maxUsage) self._sampleNum += 1 if self._sampleNum % 60 == 0: lastMinuteAverage = sum(self._usage[-60:])/60 self._minutesUsage.append(lastMinuteAverage) self._minutesMaxUsage.append(maxUsage)
5db631b9081e9af0ba5615613d6fbe26fed5b363 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/5db631b9081e9af0ba5615613d6fbe26fed5b363/AVGAppStarter.py
self._sampleNum += 1 if self._sampleNum % 60 == 0:
self._memSampleNum += 1 if self._memSampleNum % 60 == 0:
def _nextMemSample(self): curUsage = self._getValue() self._usage.append(curUsage) maxUsage = self._maxUsage[-1] if curUsage>maxUsage: maxUsage = curUsage lastMaxChangeTime = time.time() self._textNode1.text = ("Last increase in maximum: " +time.strftime("%H:%M:%S", time.localtime(lastMaxChangeTime))) self._maxUsage.append(maxUsage) self._sampleNum += 1 if self._sampleNum % 60 == 0: lastMinuteAverage = sum(self._usage[-60:])/60 self._minutesUsage.append(lastMinuteAverage) self._minutesMaxUsage.append(maxUsage)
5db631b9081e9af0ba5615613d6fbe26fed5b363 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/5db631b9081e9af0ba5615613d6fbe26fed5b363/AVGAppStarter.py
if self._sampleNum < 60*60:
if self._memSampleNum < 60*60:
def _nextMemSample(self): curUsage = self._getValue() self._usage.append(curUsage) maxUsage = self._maxUsage[-1] if curUsage>maxUsage: maxUsage = curUsage lastMaxChangeTime = time.time() self._textNode1.text = ("Last increase in maximum: " +time.strftime("%H:%M:%S", time.localtime(lastMaxChangeTime))) self._maxUsage.append(maxUsage) self._sampleNum += 1 if self._sampleNum % 60 == 0: lastMinuteAverage = sum(self._usage[-60:])/60 self._minutesUsage.append(lastMinuteAverage) self._minutesMaxUsage.append(maxUsage)
5db631b9081e9af0ba5615613d6fbe26fed5b363 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/5db631b9081e9af0ba5615613d6fbe26fed5b363/AVGAppStarter.py
self._plotLine(self._maxUsage, self._maxLineNode, maxUsage) else:
self._plotLine(self._maxUsage, self._maxLineNode, maxUsage) else:
def _nextMemSample(self): curUsage = self._getValue() self._usage.append(curUsage) maxUsage = self._maxUsage[-1] if curUsage>maxUsage: maxUsage = curUsage lastMaxChangeTime = time.time() self._textNode1.text = ("Last increase in maximum: " +time.strftime("%H:%M:%S", time.localtime(lastMaxChangeTime))) self._maxUsage.append(maxUsage) self._sampleNum += 1 if self._sampleNum % 60 == 0: lastMinuteAverage = sum(self._usage[-60:])/60 self._minutesUsage.append(lastMinuteAverage) self._minutesMaxUsage.append(maxUsage)
5db631b9081e9af0ba5615613d6fbe26fed5b363 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/5db631b9081e9af0ba5615613d6fbe26fed5b363/AVGAppStarter.py
if self._memSampleNum % 3600 == 0: del self._usage[0:3600] del self._maxUsage[0:3599] if self._memSampleNum == 604800: self._memSampleNum == 0
def _nextMemSample(self): curUsage = self._getValue() self._usage.append(curUsage) maxUsage = self._maxUsage[-1] if curUsage>maxUsage: maxUsage = curUsage lastMaxChangeTime = time.time() self._textNode1.text = ("Last increase in maximum: " +time.strftime("%H:%M:%S", time.localtime(lastMaxChangeTime))) self._maxUsage.append(maxUsage) self._sampleNum += 1 if self._sampleNum % 60 == 0: lastMinuteAverage = sum(self._usage[-60:])/60 self._minutesUsage.append(lastMinuteAverage) self._minutesMaxUsage.append(maxUsage)
5db631b9081e9af0ba5615613d6fbe26fed5b363 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/5db631b9081e9af0ba5615613d6fbe26fed5b363/AVGAppStarter.py
self._interval = g_player.setOnFrameHandler(self._nextFrameTimeSample)
self._interval = g_player.setOnFrameHandler(self._nextFrameTimeSample) self._sampleNum = 0 self._memSampleNum = 0 self._lastCurUsage = 0 self._maxFrameTime = 0 self._values = []
def _setup(self): self._interval = g_player.setOnFrameHandler(self._nextFrameTimeSample)
5db631b9081e9af0ba5615613d6fbe26fed5b363 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/5db631b9081e9af0ba5615613d6fbe26fed5b363/AVGAppStarter.py
" Time: " +time.strftime("%H:%M:%S", time.localtime(lastMaxChangeTime)))
" Time: " +time.strftime("%d.%m.%Y %H:%M:%S", time.localtime(lastMaxChangeTime)))
def _frameTimeSample(self): frameTime = self._getValue() diff = frameTime - self._lastCurUsage #if(self._sampleNum % 1800 == 0): # self._maxFrameTime = 0 if(self._sampleNum<2): self._maxFrameTime = 0 if(diff>self._maxFrameTime): lastMaxChangeTime = time.time() self._maxFrameTime = diff self._textNode0.text = ("Max FrameTime: %.f" %self._maxFrameTime + " ms" + " Time: " +time.strftime("%H:%M:%S", time.localtime(lastMaxChangeTime))) if diff>self._node.y-1: y = self._node.y-1 self._lastCurUsage = frameTime self._textNode1.text = ("Current FrameTime: %.f" %diff + " ms" ) return -diff
5db631b9081e9af0ba5615613d6fbe26fed5b363 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/5db631b9081e9af0ba5615613d6fbe26fed5b363/AVGAppStarter.py
node = avg.LineNode(pos1=(2, 2), pos2=(50, 2))
node = avg.LineNode(pos1=(2, 2), pos2=(50, 2), strokewidth=2)
def addVectorNode(): node = avg.LineNode(pos1=(2, 2), pos2=(50, 2)) canvas.appendChild(node) return node
100043bacdf2d8bf3bbda0476e2a34fd4ec06d9b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/100043bacdf2d8bf3bbda0476e2a34fd4ec06d9b/VectorTest.py
node = avg.RectNode(pos=(2, 6), size=(50, 30))
node = avg.RectNode(pos=(2, 6), size=(50, 30), strokewidth=2)
def addFilledVectorNode(): node = avg.RectNode(pos=(2, 6), size=(50, 30)) node.setEventHandler(avg.CURSORDOWN, avg.MOUSE, onDown) canvas.appendChild(node) return node
100043bacdf2d8bf3bbda0476e2a34fd4ec06d9b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/100043bacdf2d8bf3bbda0476e2a34fd4ec06d9b/VectorTest.py
lambda: self.assert_(self.__anim.isDone),
lambda: self.assert_(self.__anim.isDone()),
def abortAnim(): self.__anim.abort()
a60f3776a9d23bdc972374744d71c6c4ae0dedec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/a60f3776a9d23bdc972374744d71c6c4ae0dedec/PythonTest.py
lambda: self.assert_(self.__anim.isDone),
lambda: self.assert_(self.__anim.isDone()),
def abortAnim(): self.__anim.abort()
a60f3776a9d23bdc972374744d71c6c4ae0dedec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/a60f3776a9d23bdc972374744d71c6c4ae0dedec/PythonTest.py
lambda: self.assert_(self.__anim.isDone)
lambda: self.assert_(self.__anim.isDone())
def startAnim(): self.__onStopCalled = False node = Player.getElementByID("test") self.__anim.start()
a60f3776a9d23bdc972374744d71c6c4ae0dedec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/a60f3776a9d23bdc972374744d71c6c4ae0dedec/PythonTest.py
lambda: Player.loadCanvasString("""<canvas id="foo" size="(160, 120)"/>"""))
lambda: Player.loadCanvasString( """<canvas id="foo" size="(160, 120)"/>"""))
def testCanvasErrors(self): self.loadEmptyScene() # Missing size self.assertException( lambda: Player.loadCanvasString("""<canvas id="foo"/>""")) # Duplicate canvas id Player.loadCanvasString("""<canvas id="foo" size="(160, 120)"/>""") self.assertException( lambda: Player.loadCanvasString("""<canvas id="foo" size="(160, 120)"/>"""))
5fd33b6c85697c2ce76ea6cd093c34d66d16f306 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/5fd33b6c85697c2ce76ea6cd093c34d66d16f306/OffscreenTest.py
Player.loadSceneString(""" <?xml version="1.0"?> <scene id="testscene" width="160" height="120"> <image id="test1" href="rgb24-65x65.png" angle="0.4"/> </scene> """)
def createScene(sceneName, x): Player.loadSceneString(""" <?xml version="1.0"?> <scene id="%s" width="160" height="120"> <image id="test1" x="%s" href="rgb24-65x65.png" angle="0.4"/> </scene> """%(sceneName, str(x))) print sceneName self.node = avg.ImageNode(parent=Player.getRootNode()) self.node.href="scene:"+sceneName
def testOffscreen(self): Player.loadSceneString(""" <?xml version="1.0"?> <scene id="testscene" width="160" height="120"> <image id="test1" href="rgb24-65x65.png" angle="0.4"/> </scene> """) self._loadEmpty() node = avg.ImageNode(href="scene:testscene", parent=Player.getRootNode()) self.start(None, (None, lambda: self.compareImage("testOffscreen1", False), lambda: node.unlink(), lambda: self.compareImage("testOffscreen2", False), lambda: Player.getRootNode().appendChild(node), lambda: self.compareImage("testOffscreen1", False) ))
db1a10546b5f6a758aeab43f5c1a69819798ce2b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/db1a10546b5f6a758aeab43f5c1a69819798ce2b/PlayerTest.py
node = avg.ImageNode(href="scene:testscene", parent=Player.getRootNode())
createScene("testscene1", 0)
def testOffscreen(self): Player.loadSceneString(""" <?xml version="1.0"?> <scene id="testscene" width="160" height="120"> <image id="test1" href="rgb24-65x65.png" angle="0.4"/> </scene> """) self._loadEmpty() node = avg.ImageNode(href="scene:testscene", parent=Player.getRootNode()) self.start(None, (None, lambda: self.compareImage("testOffscreen1", False), lambda: node.unlink(), lambda: self.compareImage("testOffscreen2", False), lambda: Player.getRootNode().appendChild(node), lambda: self.compareImage("testOffscreen1", False) ))
db1a10546b5f6a758aeab43f5c1a69819798ce2b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/db1a10546b5f6a758aeab43f5c1a69819798ce2b/PlayerTest.py
(None,
(
def testOffscreen(self): Player.loadSceneString(""" <?xml version="1.0"?> <scene id="testscene" width="160" height="120"> <image id="test1" href="rgb24-65x65.png" angle="0.4"/> </scene> """) self._loadEmpty() node = avg.ImageNode(href="scene:testscene", parent=Player.getRootNode()) self.start(None, (None, lambda: self.compareImage("testOffscreen1", False), lambda: node.unlink(), lambda: self.compareImage("testOffscreen2", False), lambda: Player.getRootNode().appendChild(node), lambda: self.compareImage("testOffscreen1", False) ))
db1a10546b5f6a758aeab43f5c1a69819798ce2b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/db1a10546b5f6a758aeab43f5c1a69819798ce2b/PlayerTest.py
lambda: node.unlink(),
lambda: self.node.unlink(),
def testOffscreen(self): Player.loadSceneString(""" <?xml version="1.0"?> <scene id="testscene" width="160" height="120"> <image id="test1" href="rgb24-65x65.png" angle="0.4"/> </scene> """) self._loadEmpty() node = avg.ImageNode(href="scene:testscene", parent=Player.getRootNode()) self.start(None, (None, lambda: self.compareImage("testOffscreen1", False), lambda: node.unlink(), lambda: self.compareImage("testOffscreen2", False), lambda: Player.getRootNode().appendChild(node), lambda: self.compareImage("testOffscreen1", False) ))
db1a10546b5f6a758aeab43f5c1a69819798ce2b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/db1a10546b5f6a758aeab43f5c1a69819798ce2b/PlayerTest.py
lambda: Player.getRootNode().appendChild(node), lambda: self.compareImage("testOffscreen1", False)
lambda: Player.getRootNode().appendChild(self.node), lambda: self.compareImage("testOffscreen1", False), lambda: self.node.unlink(), lambda: createScene("testscene2", 80), lambda: self.compareImage("testOffscreen3", False)
def testOffscreen(self): Player.loadSceneString(""" <?xml version="1.0"?> <scene id="testscene" width="160" height="120"> <image id="test1" href="rgb24-65x65.png" angle="0.4"/> </scene> """) self._loadEmpty() node = avg.ImageNode(href="scene:testscene", parent=Player.getRootNode()) self.start(None, (None, lambda: self.compareImage("testOffscreen1", False), lambda: node.unlink(), lambda: self.compareImage("testOffscreen2", False), lambda: Player.getRootNode().appendChild(node), lambda: self.compareImage("testOffscreen1", False) ))
db1a10546b5f6a758aeab43f5c1a69819798ce2b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/db1a10546b5f6a758aeab43f5c1a69819798ce2b/PlayerTest.py
sys.exit(rc)
if isinstance(rc, Exception): raise rc else: sys.exit(rc) def symtree(src, dest): os.mkdir(dest) for f in os.listdir(src): fpath = os.path.join(src, f) if (f and f[0] != '.' and (os.path.isdir(fpath) or (os.path.isfile(fpath) and os.path.splitext(f)[1] == '.py'))): os.symlink(os.path.join(os.pardir, src, f), os.path.join(dest, f))
def cleanExit(rc): if g_TempPackageDir is not None: try: shutil.rmtree(g_TempPackageDir) except OSError: print 'ERROR: Cannot clean up test package directory' sys.exit(rc)
4e371d23777297aa509b86860eaff54a36fe266c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/4e371d23777297aa509b86860eaff54a36fe266c/Test.py
print 'Creating local libavg python package'
g_TempPackageDir = os.path.join(os.getcwd(), 'libavg')
def cleanExit(rc): if g_TempPackageDir is not None: try: shutil.rmtree(g_TempPackageDir) except OSError: print 'ERROR: Cannot clean up test package directory' sys.exit(rc)
4e371d23777297aa509b86860eaff54a36fe266c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/4e371d23777297aa509b86860eaff54a36fe266c/Test.py
shutil.copytree('../python', 'libavg') shutil.copy('../wrapper/__init__.py', 'libavg/')
if os.path.basename(os.getcwd()) != 'test': raise RuntimeError('Manual tests must be performed inside directory "test"') if os.path.isdir(g_TempPackageDir): print 'Cleaning up old test package' shutil.rmtree(g_TempPackageDir) symtree('../python', 'libavg') os.symlink('../../wrapper/__init__.py', 'libavg/__init__.py')
def cleanExit(rc): if g_TempPackageDir is not None: try: shutil.rmtree(g_TempPackageDir) except OSError: print 'ERROR: Cannot clean up test package directory' sys.exit(rc)
4e371d23777297aa509b86860eaff54a36fe266c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/4e371d23777297aa509b86860eaff54a36fe266c/Test.py
shutil.copytree('../../../../src/python', 'libavg') shutil.copy('../../../../src/wrapper/__init__.py', 'libavg/')
symtree('../../../../src/python', 'libavg') os.symlink('../../../../../src/wrapper/__init__.py', 'libavg/__init__.py')
def cleanExit(rc): if g_TempPackageDir is not None: try: shutil.rmtree(g_TempPackageDir) except OSError: print 'ERROR: Cannot clean up test package directory' sys.exit(rc)
4e371d23777297aa509b86860eaff54a36fe266c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/4e371d23777297aa509b86860eaff54a36fe266c/Test.py
shutil.copy('../wrapper/.libs/avg.so', 'libavg/') g_TempPackageDir = os.path.join(os.getcwd(), 'libavg')
os.symlink('../../wrapper/.libs/avg.so', 'libavg/avg.so')
def cleanExit(rc): if g_TempPackageDir is not None: try: shutil.rmtree(g_TempPackageDir) except OSError: print 'ERROR: Cannot clean up test package directory' sys.exit(rc)
4e371d23777297aa509b86860eaff54a36fe266c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/4e371d23777297aa509b86860eaff54a36fe266c/Test.py
def cleanExit(rc): if g_TempPackageDir is not None: try: shutil.rmtree(g_TempPackageDir) except OSError: print 'ERROR: Cannot clean up test package directory' sys.exit(rc)
4e371d23777297aa509b86860eaff54a36fe266c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/4e371d23777297aa509b86860eaff54a36fe266c/Test.py
raise RuntimeError('Tests would be performed with a non-local libavg package (%s)'
raise RuntimeError( 'Tests would be performed with a non-local libavg package (%s)'
def cleanExit(rc): if g_TempPackageDir is not None: try: shutil.rmtree(g_TempPackageDir) except OSError: print 'ERROR: Cannot clean up test package directory' sys.exit(rc)
4e371d23777297aa509b86860eaff54a36fe266c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/4e371d23777297aa509b86860eaff54a36fe266c/Test.py
except KeyboardInterrupt: print 'CTRL-C' cleanExit(0)
except Exception, e: cleanExit(e)
def setPixBuf(option, opt, value, parser): if value not in ('yes','no'): raise OptionValueError('argument must be "yes" or "no"') setUsePixelBuffers(value == 'yes')
4e371d23777297aa509b86860eaff54a36fe266c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/4e371d23777297aa509b86860eaff54a36fe266c/Test.py
bmp1.save("foo.png")
self.assert_(self.areSimilarBmps(bmp, bmp1, 0.01, 0.01))
def testStringConversion(): bmp = avg.Bitmap('rgb24-65x65.png') s = bmp.getPixels() bmp1 = avg.Bitmap(bmp.getSize(), avg.R8G8B8X8, "sample") bmp1.setPixels(s) bmp1.save("foo.png")
a0a3885adeb867e06522e21da39d36aa424568c8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/a0a3885adeb867e06522e21da39d36aa424568c8/ImageTest.py
def cleanExit(rc): if g_TempPackageDir is not None: try: shutil.rmtree(g_TempPackageDir) except OSError: print 'ERROR: Cannot clean up test package directory'
def cleanExit(rc): if g_TempPackageDir is not None: try: shutil.rmtree(g_TempPackageDir) except OSError: print 'ERROR: Cannot clean up test package directory'
be3113bd574c2d8e9b782bdcf7daa6a9c44ca01a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/be3113bd574c2d8e9b782bdcf7daa6a9c44ca01a/Test.py
cleanExit(app.exitCode())
if g_TempPackageDir is not None: try: shutil.rmtree(g_TempPackageDir) except OSError: print 'ERROR: Cannot clean up test package directory' sys.exit(app.exitCode())
def symtree(src, dest): os.mkdir(dest) for f in os.listdir(src): fpath = os.path.join(src, f) if (f and f[0] != '.' and (os.path.isdir(fpath) or (os.path.isfile(fpath) and os.path.splitext(f)[1] == '.py'))): os.symlink(os.path.join(os.pardir, src, f), os.path.join(dest, f))
be3113bd574c2d8e9b782bdcf7daa6a9c44ca01a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/be3113bd574c2d8e9b782bdcf7daa6a9c44ca01a/Test.py
self.__changeState(Button.STATE_DOWN)
def __pressHandlerTemplateMethod(self, event): if not self.__isCursorCaptured(event.cursorid): self.__captureCursor(event.cursorid) if event.cursorid not in self.__overCursorIds: self.__overCursorIds.add(event.cursorid) if self.__getNumberOfCapturedCursors() > 1: return
90d98bc5c607e14eb2596c4d76a5f3b4b7aef7c0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/90d98bc5c607e14eb2596c4d76a5f3b4b7aef7c0/button.py
self.__changeState(Button.STATE_DOWN)
def __pressHandlerTemplateMethod(self, event): if not self.__isCursorCaptured(event.cursorid): self.__captureCursor(event.cursorid) if event.cursorid not in self.__overCursorIds: self.__overCursorIds.add(event.cursorid) if self.__getNumberOfCapturedCursors() > 1: return
90d98bc5c607e14eb2596c4d76a5f3b4b7aef7c0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/90d98bc5c607e14eb2596c4d76a5f3b4b7aef7c0/button.py
canvas = self.makeEmptyCanvas() polygon = avg.PolygonNode(strokewidth=3, color="FF00FF", pos=((100.5,10.5), (100.5,30.5), (120.5, 10.5), (120.5,30.5)), fillcolor="00FFFF", fillopacity=0.5) canvas.insertChild(polygon, 0) self.assertException(lambda: self.start(None, []))
def addPolygon(): polygon = avg.PolygonNode(strokewidth=3, color="FF00FF", pos=((100.5, 10.5), (100.5, 30.5), (120.5, 10.5), (120.5, 30.5)), fillcolor="00FFFF", fillopacity=0.5) canvas.insertChild(polygon, 0) canvas = self.makeEmptyCanvas() self.assertException(lambda: self.start(None, [addPolygon]))
def testSelfIntersectPolygon(self): canvas = self.makeEmptyCanvas() polygon = avg.PolygonNode(strokewidth=3, color="FF00FF", pos=((100.5,10.5), (100.5,30.5), (120.5, 10.5), (120.5,30.5)), fillcolor="00FFFF", fillopacity=0.5) canvas.insertChild(polygon, 0) self.assertException(lambda: self.start(None, []))
080e431efd1395cc8a1d7607e61edd456c3cc9b2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/080e431efd1395cc8a1d7607e61edd456c3cc9b2/VectorTest.py
for filename in ["mjpeg-48x48.avi", "mpeg1-48x48.mpg", "mpeg1-48x48-sound.avi", "rgba-48x48.mov", "h264-48x48.h264", "vp6a-yuva-48x48.flv"]:
videoFiles = ["mjpeg-48x48.avi", "mpeg1-48x48.mpg", "mpeg1-48x48-sound.avi", "rgba-48x48.mov", "h264-48x48.h264"] if Player.isUsingShaders(): videoFiles.append("vp6a-yuva-48x48.flv") for filename in videoFiles:
def testInfo(): if filename == "mpeg1-48x48-sound.avi" and isThreaded: self.assert_(node.hasAudio()) else: self.assert_(not(node.hasAudio())) self.assert_((filename == "rgba-48x48.mov" or filename == "vp6a-yuva-48x48.flv") == node.hasAlpha())
c1ebc92931de4d7845d949d6b4b7417ef3d3a678 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/c1ebc92931de4d7845d949d6b4b7417ef3d3a678/AVTest.py
node = avg.colorplugin.ColorNode(fillcolor="7f7f00", id="mynode1")
node = colorplugin.ColorNode(fillcolor="7f7f00", id="mynode1")
def usePlugin1(): node = avg.colorplugin.ColorNode(fillcolor="7f7f00", id="mynode1") Player.getElementByID("container").appendChild(node) mynode = Player.getElementByID("mynode1") self.assert_(mynode.fillcolor == "7f7f00")
15035701a22a56fc0a3b78b9c2a5c3db0373d8bc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/15035701a22a56fc0a3b78b9c2a5c3db0373d8bc/PluginTest.py
self.assert_(root.getChild(0).getGlyphPos(6) != root.getChild(1).getGlyphPos(6))
noHint = root.getChild(0) hint = root.getChild(1) posNoHint = noHint.getGlyphPos(6) posHint = hint.getGlyphPos(6) self.assert_(posNoHint != posHint) noHint.hint = True hint.hint = False self.assert_(posNoHint == hint.getGlyphPos(6)) self.assert_(posHint == noHint.getGlyphPos(6))
def checkPositions(): root = Player.getRootNode()
16a60f5a2375f2ab243096d35f13e4dcfd85235c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/16a60f5a2375f2ab243096d35f13e4dcfd85235c/WordsTest.py
def testSetWidth(self): Player.loadString("""<avg width="160" height="120"></avg>""") text = "42 " * 42 textNode = avg.WordsNode( parent=Player.getRootNode(), fontsize = 10, font = "Bitstream Vera Sans", text = text) def testSize(p1, p2): self.assert_(abs(p1.x - p2.x) < 5) self.assert_(abs(p1.y - p2.y) < 5) testSize(textNode.size, avg.Point2D(630,13)) testSize(textNode.getMediaSize(), avg.Point2D(630,13)) mediaSize = textNode.getMediaSize() def changeSize(): textNode.width = 50 testSize(textNode.size, avg.Point2D(50,182)) testSize(textNode.getMediaSize(), avg.Point2D(45,182)) self.assert_(mediaSize != textNode.getMediaSize()) self.start(None, [lambda: changeSize()])
def testGetTextAsDisplayed(self): orgText = "A<br/>B C <b>D</b> E F G H <i>Ä</i> Ö Ü ? Ì Á<br/>Í Å Ø ∏ ~ ç Ç Å" orgTextWithout = "A\nB C D E F G H Ä Ö Ü ? Ì Á\nÍ Å Ø ∏ ~ ç Ç Å" textNode = avg.WordsNode(fontsize=30, font = "Bitstream Vera Sans", text = orgText, width = 300) self.assert_(orgTextWithout == textNode.getTextAsDisplayed())
16a60f5a2375f2ab243096d35f13e4dcfd85235c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7300/16a60f5a2375f2ab243096d35f13e4dcfd85235c/WordsTest.py