Merge lp:~widelands-dev/widelands/bug-1506084 into lp:widelands

Proposed by TiborB
Status: Merged
Merged at revision: 7555
Proposed branch: lp:~widelands-dev/widelands/bug-1506084
Merge into: lp:widelands
Diff against target: 71 lines (+27/-10)
2 files modified
src/logic/ship.cc (+5/-1)
test/maps/ship_transportation.wmf/scripting/test_rip_second_port_with_ware_in_portdock.lua (+22/-9)
To merge this branch: bzr merge lp:~widelands-dev/widelands/bug-1506084
Reviewer Review Type Date Requested Status
SirVer Approve
Review via email: mp+274758@code.launchpad.net

Description of the change

This fixes regression test fail (I hope). Two issues here:

test script not working properly (changed, I added more sleeps)
small change in fleet/ship logic

To post a comment you must log in.
7556. By TiborB

assert values switched

Revision history for this message
SirVer (sirver) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/logic/ship.cc'
--- src/logic/ship.cc 2015-09-03 12:56:54 +0000
+++ src/logic/ship.cc 2015-10-16 19:36:38 +0000
@@ -242,8 +242,12 @@
242242
243 PortDock* dst = get_destination(game);243 PortDock* dst = get_destination(game);
244 if (!dst) {244 if (!dst) {
245 //here we just do nothing, this is usually OK245 // The ship has lost its destination (port is gone perhaps) so
246 // stop and start being idle
246 start_task_idle(game, descr().main_animation(), 10000);247 start_task_idle(game, descr().main_animation(), 10000);
248 // ...but let the fleet recalcualte ships destinations (this ship
249 // needs new destination)
250 m_fleet->update(game);
247 return true;251 return true;
248 }252 }
249253
250254
=== modified file 'test/maps/ship_transportation.wmf/scripting/test_rip_second_port_with_ware_in_portdock.lua'
--- test/maps/ship_transportation.wmf/scripting/test_rip_second_port_with_ware_in_portdock.lua 2014-01-18 12:40:08 +0000
+++ test/maps/ship_transportation.wmf/scripting/test_rip_second_port_with_ware_in_portdock.lua 2015-10-16 19:36:38 +0000
@@ -9,27 +9,40 @@
9 port1():set_wares{9 port1():set_wares{
10 blackwood = 1,10 blackwood = 1,
11 }11 }
12 sleep(12000)12
13 sleep(1000)
1314
14 -- The ship should not yet have picked up the worker from the15 -- The ship should not yet have picked up the ware from the
15 -- portdock.16 -- portdock.
16 assert_equal(p1:get_wares("blackwood"), 1)17 assert_equal(1, p1:get_wares("blackwood"))
17 assert_equal(port1():get_wares("blackwood"), 0)18 assert_equal(0, port1():get_wares("blackwood"))
19
20 while ship:get_wares() == 0 do
21 -- ship still on the way to the bottom port
22 sleep(50)
23 end
1824
25 --now it is loaded with something and port empty..
26 sleep(2000)
27 assert_equal(0, port1():get_wares("blackwood"))
28 -- ...and on the way to the north, so let remove the upper port
19 port2():remove()29 port2():remove()
20 sleep(100)30 sleep(100)
2131
22 stable_save("ware_in_portdock")32 stable_save("ware_in_portdock")
2333
24 sleep(8000)34 --ship has to get to the place of former upper port and then return back to the bottom port
35 sleep(30000)
2536
26 -- Worker should be back in port.37 -- Ware should be back in port.
27 assert_equal(p1:get_wares("blackwood"), 1)38 assert_equal(1, p1:get_wares("blackwood"))
28 assert_equal(port1():get_wares("blackwood"), 1)39 assert_equal(1, port1():get_wares("blackwood"))
2940
30 -- Create port again.41 -- Create port again.
31 create_second_port()42 create_second_port()
3243
44 sleep (10000)
45
33 while ship:get_wares() == 0 do46 while ship:get_wares() == 0 do
34 sleep(50)47 sleep(50)
35 end48 end

Subscribers

People subscribed via source and target branches

to status/vote changes: