Exemplo n.º 1
0
	def setUp(self):
		''' '''

		self.chunkSize = 4
		self.playerFactory = PlayerFactorySetup.create()
		self.blockTypeFactory = BlockTypeFactorySetup.create()

		self.encoder = EncoderSetup.create( blockTypeFactory = self.blockTypeFactory
				, playerFactory = self.playerFactory
				)
		self.generator = ChunkGeneratorSetup.create( chunkSize = self.chunkSize
				, playerFactory = self.playerFactory
				, blockTypeFactory = self.blockTypeFactory
				)
		self.position = Vec3( 0, 0, 0 )
		self.fileObj = ChunkFileSetup.create()

		self.chunk = ChunkSetup.create( fileObj = self.fileObj, encoder = self.encoder
				, generator = self.generator, chunkSize = self.chunkSize
				, position = self.position
				)

		node = NodePath()
		self.chunk.load( node )

		world = self.playerFactory.fromName( '__WORLD__' )
		dirtType = self.blockTypeFactory.fromName( 'dirt' )
		self.dirt = dirtType.newBlock( world )

		return None
	def it_should_initialize( self ):
		''' '''
		encoder, playerFactory, blockTypeFactory, chunkSize = ChunkGeneratorSetup.prepare()

		self.assertIsInstance(
				ChunkGenerator( encoder, playerFactory, blockTypeFactory, chunkSize )
				, ChunkGenerator
				)
		return None
	def setUp( self ):
		''' '''
		self.fileObj = FileObjectMock()
		self.position = Vec3( 0, 0, 0 )

		self.encoder = EncoderSetup.create()
		self.playerFactory = PlayerFactorySetup.create()
		self.blockTypeFactory = BlockTypeFactorySetup.create()
		self.chunkSize = 16

		self.generator = ChunkGeneratorSetup.create( encoder = self.encoder
				, playerFactory = self.playerFactory
				, blockTypeFactory = self.blockTypeFactory
				, chunkSize = self.chunkSize
				)
		return None