Merge lp:~smspillaz/compiz-core/compiz-core.fix_908042 into lp:compiz-core/0.9.5

Proposed by Sam Spilsbury
Status: Merged
Merged at revision: 2901
Proposed branch: lp:~smspillaz/compiz-core/compiz-core.fix_908042
Merge into: lp:compiz-core/0.9.5
Diff against target: 46 lines (+6/-5)
1 file modified
src/timer/tests/callbacks/src/test-timer-callbacks.cpp (+6/-5)
To merge this branch: bzr merge lp:~smspillaz/compiz-core/compiz-core.fix_908042
Reviewer Review Type Date Requested Status
Daniel van Vugt Approve
Thomas Voß Approve
Review via email: mp+87468@code.launchpad.net

Description of the change

Fixes failing timer test, bug 908042

To post a comment you must log in.
Revision history for this message
Thomas Voß (thomas-voss) wrote :

Looks good to me.

review: Approve
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

It does look OK. But why the use of both signed and unsigned ints?
  unsigned int calls;
  int maxCalls;

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/timer/tests/callbacks/src/test-timer-callbacks.cpp'
2--- src/timer/tests/callbacks/src/test-timer-callbacks.cpp 2011-12-23 05:32:02 +0000
3+++ src/timer/tests/callbacks/src/test-timer-callbacks.cpp 2012-01-04 12:51:24 +0000
4@@ -67,12 +67,13 @@
5 CompTimerTestCallbackDispatchTable (),
6 mMainLoop (ml)
7 {
8+ memset (&mCallsCounter, 0, sizeof (mCallsCounter));
9 ON_CALL (*this, callback1 (_)).WillByDefault (Invoke (this, &MockCompTimerTestCallbackDispatchTable::QuitIfLast));
10 ON_CALL (*this, callback2 (_)).WillByDefault (Invoke (this, &MockCompTimerTestCallbackDispatchTable::QuitIfLast));
11 ON_CALL (*this, callback3 (_)).WillByDefault (Invoke (this, &MockCompTimerTestCallbackDispatchTable::QuitIfLast));
12 };
13
14- void setMax (unsigned int timerId, unsigned int maxCalls)
15+ void setMax (unsigned int timerId, int maxCalls)
16 {
17 mCallsCounter[timerId].maxCalls = maxCalls;
18 }
19@@ -84,15 +85,15 @@
20 {
21 public:
22 unsigned int calls;
23- unsigned int maxCalls;
24+ int maxCalls;
25 } mCallsCounter[3];
26
27 bool QuitIfLast (unsigned int num)
28 {
29 mCallsCounter[num].calls++;
30
31- if (!mCallsCounter[num].maxCalls ||
32- mCallsCounter[num].maxCalls == mCallsCounter[num].calls)
33+ if (mCallsCounter[num].maxCalls < 0 ||
34+ static_cast <unsigned int> (mCallsCounter[num].maxCalls) == mCallsCounter[num].calls)
35 {
36 /* We are the last timer, quit the main loop */
37 if (TimeoutHandler::Default ()->timers ().size () == 0)
38@@ -141,7 +142,7 @@
39 void AddTimer (unsigned int min,
40 unsigned int max,
41 const boost::function <bool ()> &callback,
42- unsigned int maxAllowedCalls)
43+ int maxAllowedCalls)
44 {
45 timers.push_back (new CompTimer ());
46 timers.back ()->setTimes (min, max);

Subscribers

People subscribed via source and target branches