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
1=== modified file 'src/logic/ship.cc'
2--- src/logic/ship.cc 2015-09-03 12:56:54 +0000
3+++ src/logic/ship.cc 2015-10-16 19:36:38 +0000
4@@ -242,8 +242,12 @@
5
6 PortDock* dst = get_destination(game);
7 if (!dst) {
8- //here we just do nothing, this is usually OK
9+ // The ship has lost its destination (port is gone perhaps) so
10+ // stop and start being idle
11 start_task_idle(game, descr().main_animation(), 10000);
12+ // ...but let the fleet recalcualte ships destinations (this ship
13+ // needs new destination)
14+ m_fleet->update(game);
15 return true;
16 }
17
18
19=== modified file 'test/maps/ship_transportation.wmf/scripting/test_rip_second_port_with_ware_in_portdock.lua'
20--- test/maps/ship_transportation.wmf/scripting/test_rip_second_port_with_ware_in_portdock.lua 2014-01-18 12:40:08 +0000
21+++ test/maps/ship_transportation.wmf/scripting/test_rip_second_port_with_ware_in_portdock.lua 2015-10-16 19:36:38 +0000
22@@ -9,27 +9,40 @@
23 port1():set_wares{
24 blackwood = 1,
25 }
26- sleep(12000)
27+
28+ sleep(1000)
29
30- -- The ship should not yet have picked up the worker from the
31+ -- The ship should not yet have picked up the ware from the
32 -- portdock.
33- assert_equal(p1:get_wares("blackwood"), 1)
34- assert_equal(port1():get_wares("blackwood"), 0)
35+ assert_equal(1, p1:get_wares("blackwood"))
36+ assert_equal(0, port1():get_wares("blackwood"))
37+
38+ while ship:get_wares() == 0 do
39+ -- ship still on the way to the bottom port
40+ sleep(50)
41+ end
42
43+ --now it is loaded with something and port empty..
44+ sleep(2000)
45+ assert_equal(0, port1():get_wares("blackwood"))
46+ -- ...and on the way to the north, so let remove the upper port
47 port2():remove()
48 sleep(100)
49
50 stable_save("ware_in_portdock")
51
52- sleep(8000)
53+ --ship has to get to the place of former upper port and then return back to the bottom port
54+ sleep(30000)
55
56- -- Worker should be back in port.
57- assert_equal(p1:get_wares("blackwood"), 1)
58- assert_equal(port1():get_wares("blackwood"), 1)
59+ -- Ware should be back in port.
60+ assert_equal(1, p1:get_wares("blackwood"))
61+ assert_equal(1, port1():get_wares("blackwood"))
62
63 -- Create port again.
64 create_second_port()
65-
66+
67+ sleep (10000)
68+
69 while ship:get_wares() == 0 do
70 sleep(50)
71 end

Subscribers

People subscribed via source and target branches

to status/vote changes: