def testGetCwdObject(self): x = npython.new('nroot','/x') x3 = npython.sel('/x') x2 = npython.GetCwdObject() assert x is x2, "Error diff object returned, must be same" npython.delete('/x')
def testRefCounts(self): refcountstest = npython.new('nroot', '/refcountstest') recount = refcountstest.getrefcount() assert recount, "Refcount for object not incremenated" npython.delete('/refcountstest')
def tod3d7hal(): if npython.exists("/sys/servers/gfx"): npython.delete("/sys/servers/gfx") gfx = npython.new("nd3d7server", "/sys/servers/gfx") # gfx.setdisplaymode='dev(0)-w(640)-h(480)' # #gfx.setdisplaymode='dev(0)-w(580)-h(420)' gfx.setdisplaymode("dev(20)-w(640)-h(480)") init_gfxserver()
def tod3d7ref(): if npython.exists("/sys/share/display/21]"): if npython.exists("/sys/servers/gfx"): npython.delete("/sys/servers/gfx") gfx = npython.new("nd3d7server", "/sys/servers/gfx") npython.set("/sys/servers/gfx.setdisplaymode", "dev(21)-w(580)-h(420)") init_gfxserver() else: pass
def testSetCommand(self): # Returns an opaque 'Nebula Object' object = npython.new('n3dnode','four') # Select the object npython.sel('four') # Set a value on the object npython.set('txyz',0,30,0) # Clean up and delete object npython.sel('..') npython.delete('four')
def tod3d7tnlhal(): if npython.exists("/sys/servers/gfx"): npython.delete("/sys/servers/gfx") gfx = npython.new("nd3d7server", "/sys/servers/gfx") if npython.exists("/sys/share/display/10]"): npython.set("/sys/servers/gfx.setdisplaymode", "dev(10)-w(580)-h(420)") else: # puts ('"d3d','hardware','tl','not','supported!"') npython.set("/sys/servers/gfx.setdisplaymode", "w(580)-h(420)") init_gfxserver()
def testSameObjectReturn(self): root = npython.sel('/') ee = npython.new('nroot', '/ee') ee_same = npython.sel('/ee') ee_same2 = root['ee'] assert ee is ee_same, "Returned diffrent objects. Must be same object" assert ee is ee_same2, "Returned diffrent objects. Must be same object" npython.sel('/') npython.delete('/ee')
def testDeleteCommand(self): # Returns an opaque 'Nebula Object' object = npython.new('n3dnode','three') # Test for its presence result = npython.exists('three') assert locals().has_key('object'), 'Object not created' assert result, 'Object cannot be located' # Delete object npython.delete('three') # Test for its presence result = npython.exists('three') assert result == 0, 'Object cannot be deleted'
def testDeleteObjectAccess(self): x = npython.new('nroot','/x') x_child = npython.new('nroot','/x/x3') x_child_same = x['x3'] assert x_child is x_child_same, "Error in same object return" npython.delete('/x') try: x_child.getfulname() except npython.Npython_Error: pass # all right else: assert 1 == 0, "Exception not thrown then accessing deleted nebula object"
def testMultipleNewCommand(self): # Make a few of these... print 'Making!' objectSet = [] for num in xrange(10): name = str(num) # Returns an opaque 'Nebula Object' object = npython.new('n3dnode', name) # Test for its presence result = npython.exists(name) assert locals().has_key('object'), 'Object not created' assert result, 'Object cannot be located' objectSet.append(object) # Cleanup print 'Cleaning up...' for num in xrange(10): name = str(num) npython.delete(name)
def loadScript(self, script, brightness): npython.sel('/') npython.delete('/usr/scene') npython.new('n3dnode', '/usr/scene') npython.set('/sys/servers/console.unwatch') npython.set('/sys/servers/time.starttime') npython.set('/sys/servers/shadow.setcastshadows', 0) if self.execNamespace.has_key('tl'): self.execNamespace['tl'].destroy() del self.execNamespace['tl'] npython.set('/sys/servers/time.lockdeltat', 0.0) gfx = npython.sel('/sys/servers/gfx') apply(gfx.setclearcolor, ((brightness),) * 4) self.execNamespace['bg'] = brightness print 'Executing', script execfile(script, self.execNamespace) observerlib.orig()
def testCreationOfNewObject(self): x = npython.new('nroot','/x') npython.delete('/x') x2 = npython.new('nroot','/x') assert not (x is x2), "Error in same object return - returned same object, must be diff"
def testLoopDictLookup(self): root = npython.sel('/') npython.new('nroot', '/ee') for obj in root: assert locals().has_key('obj'), "Can't lookup object by iterator" npython.delete('/ee')
def tod3d7emu(): if npython.exists("/sys/servers/gfx"): npython.delete("/sys/servers/gfx") gfx = npython.new("nd3d7server", "/sys/servers/gfx") npython.set("/sys/servers/gfx.setdisplaymode", "dev(20)-w(580)-h(420)") init_gfxserver()
def togl(): if npython.exists("/sys/servers/gfx"): npython.delete("/sys/servers/gfx") gfx = npython.new("nglserver", "/sys/servers/gfx/") npython.set("/sys/servers/gfx.setdisplaymode", "w(580)-h(420)") init_gfxserver()