• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python helper.found_settlement函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tests.gui.helper.found_settlement函数的典型用法代码示例。如果您正苦于以下问题:Python found_settlement函数的具体用法?Python found_settlement怎么用?Python found_settlement使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了found_settlement函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_traderoute

def test_traderoute(gui):
	"""Check that a ship's route is configured correctly after setting it up using the GUI."""

	ship = get_player_ship(gui.session)
	gui.select([ship])

	# Create the first settlement
	found_settlement(gui, (36, 34), (38, 39))

	# Give the resources back to the ship
	# Click the trade button
	gui.trigger('overview_trade_ship', 'trade')

	# Get the default amount (50 t, which is more than all available) of everything
	gui.trigger('buy_sell_goods', 'inventory_entry_0')
	gui.trigger('buy_sell_goods', 'inventory_entry_1')
	gui.trigger('buy_sell_goods', 'inventory_entry_2')
	gui.trigger('buy_sell_goods', 'inventory_entry_3')

	# Create the second settlement
	found_settlement(gui, (27, 28), (28, 22))

	# Open the configure trade route widget
	gui.trigger('overview_trade_ship', 'configure_route')

	# The trade route widget is visible
	assert gui.find(name='configure_route')
	route_widget = gui.session.ingame_gui._old_menu.current_tab.route_menu

	assert not ship.route.wait_at_load
	assert not ship.route.wait_at_unload
	assert not ship.route.waypoints

	# Select the first waypoint for the trade route
	event = Mock()
	event.getButton.return_value = fife.MouseEvent.LEFT
	event.map_coords = 38, 39
	route_widget.on_map_click(event, False)

	# Select the other waypoint for the trade route
	event = Mock()
	event.getButton.return_value = fife.MouseEvent.LEFT
	event.map_coords = 28, 22
	route_widget.on_map_click(event, False)

	# Set the resources to be loaded from settlement on the left and the amount
	gui.trigger('configure_route/container_1/slot_0', 'button', mouse='left') # Select the second warehouse's first slot
	gui.trigger('configure_route', 'resource_%d' % RES.FOOD)
	gui.find('configure_route/container_1/slot_0/slider').slide(120)

	# Check if the ship obeys the state of "Wait at load" and "Wait at unload"
	gui.trigger('configure_route', 'wait_at_load')
	gui.trigger('configure_route', 'wait_at_unload')

	assert ship.route.wait_at_load
	assert ship.route.wait_at_unload
	assert len(ship.route.waypoints) == 2
	assert Point(38, 39) in ship.route.waypoints[0]['warehouse'].position
	assert Point(28, 22) in ship.route.waypoints[1]['warehouse'].position
	assert ship.route.waypoints[1]['resource_list'] == {RES.FOOD: 120}
开发者ID:BenjaminHarper,项目名称:unknown-horizons,代码行数:60,代码来源:test_traderoute.py


示例2: test_ticket_1520

def test_ticket_1520(gui):
	"""
	Crash when completing build after outlined/related buildings were removed.
	"""

	found_settlement(gui, (8, 2), (10, 6))

	ground_map = gui.session.world.islands[0].ground_map

	# Build a tent
	gui.trigger('mainhud', 'build')
	gui.trigger('tab', 'button_01')
	gui.cursor_click(7, 9, 'left')

	assert ground_map[(7, 9)].object.id == BUILDINGS.RESIDENTIAL

	# Start building a mainsquare (not releasing left mouse button)
	gui.trigger('tab', 'button_02')
	gui.cursor_move(13, 11)
	gui.cursor_press_button(13, 11, 'left')

	# remove tent
	Tear( ground_map[(7, 9)].object ).execute(gui.session)

	# release mouse button, finish build
	gui.cursor_release_button(13, 11, 'left')
开发者ID:BenjaminHarper,项目名称:unknown-horizons,代码行数:26,代码来源:test_bugs.py


示例3: test_ticket_1948

def test_ticket_1948(gui):
	"""Triggers a crash that happens when building a storage tent on the border of the settlement"""
	# Units cannot be selected right now, you need to do it this way. This is almost
	# the same as selecting it with the mouse
	ship = get_player_ship(gui.session)
	gui.select([ship])
	found_settlement(gui, (59, 1), (56, 3))

	# Select storage tent
	gui.trigger('mainhud', 'build')
	gui.trigger('tab', 'button_11')
	# Build storage at the border of the settlement
	gui.cursor_click(37, 20, 'left')
开发者ID:BenjaminHarper,项目名称:unknown-horizons,代码行数:13,代码来源:test_bugs.py


示例4: test_tearing

def test_tearing(gui):
	found_settlement(gui, (11, 1), (11, 6))

	# remove some trees
	gui.trigger('mainhud', 'destroy_tool')
	gui.cursor_drag((5, 7), (11, 16), 'left')

	# build 4 tents
	gui.trigger('mainhud', 'build')
	gui.trigger('tab', 'button_01')
	gui.cursor_drag((7, 9), (10, 12), 'left')

	# try to remove an area that includes the tents, some trees and
	# the warehouse
	gui.trigger('mainhud', 'destroy_tool')
	gui.cursor_drag((5, 15), (15, 3), 'left')
开发者ID:flaviusanton,项目名称:unknown-horizons,代码行数:16,代码来源:test_mousetools.py


示例5: test_tearing

def test_tearing(gui):
    found_settlement(gui, (11, 1), (11, 6))

    # remove some trees
    gui.trigger("mainhud/destroy_tool")
    gui.cursor_drag((5, 7), (11, 16), "left")

    # build 4 tents
    gui.trigger("mainhud/build")
    gui.trigger("tab/button_01")
    gui.cursor_drag((7, 9), (10, 12), "left")

    # try to remove an area that includes the tents, some trees and
    # the warehouse
    gui.trigger("mainhud/destroy_tool")
    gui.cursor_drag((5, 15), (15, 3), "left")
开发者ID:unknown-horizons,项目名称:unknown-horizons,代码行数:16,代码来源:test_mousetools.py


示例6: test_pipette

def test_pipette(gui):
	found_settlement(gui, (11, 1), (11, 6))

	# select mountain, can not be build
	gui.press_key(gui.Key.O)
	gui.cursor_click(6, 18, 'left')
	assert not gui.find('place_building')

	# build signal fire
	gui.trigger('mainhud', 'build')
	gui.trigger('tab', 'button_22')
	gui.cursor_click(7, 7, 'left')

	# activate pipette, select signal fire, place it next to the other
	gui.press_key(gui.Key.O)
	gui.cursor_click(7, 7, 'left')
	gui.cursor_click(6, 7, 'left')
	
	# select signal fire, check if it's actually there
	gui.cursor_click(6, 7, 'left')
	assert gui.find('overview_signalfire')
开发者ID:flaviusanton,项目名称:unknown-horizons,代码行数:21,代码来源:test_mousetools.py


示例7: test_ticket_1509

def test_ticket_1509(gui):
	"""
	Crash when quickly switching between tent tabs.
	"""

	found_settlement(gui, (8, 2), (10, 6))

	# Build a tent
	gui.trigger('mainhud', 'build')
	gui.trigger('tab', 'button_01')
	gui.cursor_click(7, 10, 'left')

	# Select tent
	gui.cursor_click(7, 10, 'left')

	# quickly switch between tabs
	gui.trigger('tab_base', '1')
	gui.run()
	gui.trigger('tab_base', '0')
	gui.run()
	gui.trigger('tab_base', '1')
开发者ID:BenjaminHarper,项目名称:unknown-horizons,代码行数:21,代码来源:test_bugs.py


示例8: test_pipette

def test_pipette(gui):
    found_settlement(gui, (11, 1), (11, 6))

    # select mountain, can not be build
    gui.press_key(gui.Key.O)
    gui.cursor_click(6, 18, "left")
    assert not gui.find("place_building")

    # build signal fire
    gui.trigger("mainhud/build")
    gui.trigger("tab/button_22")
    gui.cursor_click(7, 7, "left")

    # activate pipette, select signal fire, place it next to the other
    gui.press_key(gui.Key.O)
    gui.cursor_click(7, 7, "left")
    gui.cursor_click(6, 7, "left")

    # select signal fire, check if it's actually there
    gui.cursor_click(6, 7, "left")
    assert gui.find("overview_signalfire")
开发者ID:unknown-horizons,项目名称:unknown-horizons,代码行数:21,代码来源:test_mousetools.py


示例9: test_pavilion_build_crash_built_via_settler_related_tab

def test_pavilion_build_crash_built_via_settler_related_tab(gui):
	"""
	"""

	found_settlement(gui, (59, 1), (56, 3))

	# Build settler
	gui.trigger('mainhud', 'build')
	gui.trigger('tab', 'button_01')
	gui.cursor_click(52, 7, 'left')

	# Select settler
	gui.cursor_click(52, 7, 'left')

	# Open build related tab
	gui.trigger('tab_base', '1')

	# Select pavilion
	gui.trigger('overview_buildrelated', 'build5')

	# Plant it
	gui.cursor_click(49, 6, 'left')
开发者ID:BenjaminHarper,项目名称:unknown-horizons,代码行数:22,代码来源:test_bugs.py


示例10: test_ticket_1371

def test_ticket_1371(gui):
	"""
	Build related tab becomes invisible.

	 * use uninterrupted building (press shift)
	 * click on lumberjack
	 * click on the 'build related' tab
	 * click on the tree
	 * build a tree

     => tab itself is invisible, but buttons for choosing it aren't
	"""

	found_settlement(gui, (59, 1), (56, 3))

	# Build lumberjack
	gui.trigger('mainhud', 'build')
	gui.trigger('tab', 'button_03')
	gui.cursor_click(52, 7, 'left')

	# Select lumberjack
	gui.cursor_click(52, 7, 'left')

	# Open build related tab
	gui.trigger('tab_base', '1')

	# Select tree
	gui.trigger('overview_buildrelated', 'build17')

	# Plant a tree (without uninterrupted building)
	gui.cursor_click(49, 6, 'left')
	assert gui.find(name='overview_buildrelated')

	# Select tree again and plant it with uninterrupted building
	gui.trigger('overview_buildrelated', 'build17')
	gui.cursor_click(49, 7, 'left', shift=True)

	# Tab should still be there
	assert gui.find(name='overview_buildrelated')
开发者ID:BenjaminHarper,项目名称:unknown-horizons,代码行数:39,代码来源:test_bugs.py


示例11: test_ticket_2475

def test_ticket_2475(gui):
	"""Game crashes when two resources are produced in the same tick and the production
	finished icon is about to be shown."""

	# speed up animation to trigger bug earlier
	gui.session.ingame_gui.production_finished_icon_manager.animation_duration = 1

	ship = get_player_ship(gui.session)
	gui.select([ship])
	settlement = found_settlement(gui, (13, 64), (17, 62))

	# Place a lumberjack
	gui.trigger('mainhud/build')
	gui.trigger('tab/button_03')
	gui.cursor_click(18, 57, 'left', shift=True)

	lumberjack = settlement.buildings_by_id[BUILDINGS.LUMBERJACK][0]
	storage = lumberjack.get_component(StorageComponent)
	producer = lumberjack.get_component(Producer)

	storage.inventory.alter(RES.BOARDS, 5)

	producer.on_production_finished({RES.BOARDS: 1})
	producer.on_production_finished({RES.BOARDS: 1})
开发者ID:MarkusHackspacher,项目名称:unknown-horizons,代码行数:24,代码来源:test_bugs.py


示例12: test_found_settlement

def test_found_settlement(gui):
	"""
	Found a settlement.
	"""

	player = gui.session.world.player
	assert not player.settlements

	found_settlement(gui, (68, 10), (64, 12))

	assert len(player.settlements) == 1

	# activate the build menu
	ground_map = gui.session.world.islands[0].ground_map
	gui.trigger('mainhud', 'build')

	# build a lumberjack
	gui.trigger('tab', 'button_03')
	gui.cursor_click(55, 5, 'left')
	assert(ground_map[(55, 5)].object.id == BUILDINGS.LUMBERJACK)

	# build a storage
	gui.trigger('tab', 'button_11')
	gui.cursor_click(55, 15, 'left')
	storage = ground_map[(55, 15)].object
	assert(storage.id == BUILDINGS.STORAGE)

	# connect the lumberjack and storage using a road
	gui.trigger('tab', 'button_21')
	for y in xrange(7, 15):
		gui.cursor_click(55, y, 'left')
		assert(ground_map[(55, y)].object.id == BUILDINGS.TRAIL)
	gui.cursor_click(55, y, 'right')

	# select the storage
	gui.cursor_click(55, 15, 'left')
	gui.trigger('tab_base', '0')
	assert gui.find('tab_account')
	collectors = storage.get_component(CollectingComponent).get_local_collectors()

	while True:
		if any(collector.state is Collector.states.moving_to_target for collector in collectors):
			break
		gui.run()

	# remove the storage, trigger ticket 1441
	def func():
		assert gui.find('popup_window') is not None
		gui.trigger('popup_window', 'okButton')

	with gui.handler(func):
		gui.press_key(gui.Key.DELETE)

	start = time.time()
	# wait 0.5 seconds
	while time.time() - start < 0.5:
		gui.run()
	assert ground_map[(55, 15)].object is None

	# open build menu again
	gui.trigger('mainhud', 'build')

	# build a fisher
	gui.trigger('tab', 'button_33')
	gui.cursor_click(60, 4, 'left')
	fisher = ground_map[(60, 4)].object
	assert(fisher.id == BUILDINGS.FISHER)

	# connect the lumberjack and fisher using a road
	gui.trigger('tab', 'button_21')
	for x in xrange(57, 60):
		gui.cursor_click(x, 5, 'left')
		assert(ground_map[(x, 5)].object.id == BUILDINGS.TRAIL)
	gui.cursor_click(x, 5, 'right')

	# trigger ticket 1767
	# build a signal fire
	gui.trigger('tab', 'button_22')
	gui.cursor_click(58, 5, 'left')
	gui.cursor_click(58, 4, 'left')
开发者ID:ErwinJunge,项目名称:unknown-horizons,代码行数:80,代码来源:test_build.py



注:本文中的tests.gui.helper.found_settlement函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python helper.get_player_ship函数代码示例发布时间:2022-05-27
下一篇:
Python goldtest.compare函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap