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
=== modified file 'src/timer/tests/callbacks/src/test-timer-callbacks.cpp'
--- src/timer/tests/callbacks/src/test-timer-callbacks.cpp 2011-12-23 05:32:02 +0000
+++ src/timer/tests/callbacks/src/test-timer-callbacks.cpp 2012-01-04 12:51:24 +0000
@@ -67,12 +67,13 @@
67 CompTimerTestCallbackDispatchTable (),67 CompTimerTestCallbackDispatchTable (),
68 mMainLoop (ml)68 mMainLoop (ml)
69 {69 {
70 memset (&mCallsCounter, 0, sizeof (mCallsCounter));
70 ON_CALL (*this, callback1 (_)).WillByDefault (Invoke (this, &MockCompTimerTestCallbackDispatchTable::QuitIfLast));71 ON_CALL (*this, callback1 (_)).WillByDefault (Invoke (this, &MockCompTimerTestCallbackDispatchTable::QuitIfLast));
71 ON_CALL (*this, callback2 (_)).WillByDefault (Invoke (this, &MockCompTimerTestCallbackDispatchTable::QuitIfLast));72 ON_CALL (*this, callback2 (_)).WillByDefault (Invoke (this, &MockCompTimerTestCallbackDispatchTable::QuitIfLast));
72 ON_CALL (*this, callback3 (_)).WillByDefault (Invoke (this, &MockCompTimerTestCallbackDispatchTable::QuitIfLast));73 ON_CALL (*this, callback3 (_)).WillByDefault (Invoke (this, &MockCompTimerTestCallbackDispatchTable::QuitIfLast));
73 };74 };
7475
75 void setMax (unsigned int timerId, unsigned int maxCalls)76 void setMax (unsigned int timerId, int maxCalls)
76 {77 {
77 mCallsCounter[timerId].maxCalls = maxCalls;78 mCallsCounter[timerId].maxCalls = maxCalls;
78 }79 }
@@ -84,15 +85,15 @@
84 {85 {
85 public:86 public:
86 unsigned int calls;87 unsigned int calls;
87 unsigned int maxCalls;88 int maxCalls;
88 } mCallsCounter[3];89 } mCallsCounter[3];
8990
90 bool QuitIfLast (unsigned int num)91 bool QuitIfLast (unsigned int num)
91 {92 {
92 mCallsCounter[num].calls++;93 mCallsCounter[num].calls++;
9394
94 if (!mCallsCounter[num].maxCalls ||95 if (mCallsCounter[num].maxCalls < 0 ||
95 mCallsCounter[num].maxCalls == mCallsCounter[num].calls)96 static_cast <unsigned int> (mCallsCounter[num].maxCalls) == mCallsCounter[num].calls)
96 {97 {
97 /* We are the last timer, quit the main loop */98 /* We are the last timer, quit the main loop */
98 if (TimeoutHandler::Default ()->timers ().size () == 0)99 if (TimeoutHandler::Default ()->timers ().size () == 0)
@@ -141,7 +142,7 @@
141 void AddTimer (unsigned int min,142 void AddTimer (unsigned int min,
142 unsigned int max,143 unsigned int max,
143 const boost::function <bool ()> &callback,144 const boost::function <bool ()> &callback,
144 unsigned int maxAllowedCalls)145 int maxAllowedCalls)
145 {146 {
146 timers.push_back (new CompTimer ());147 timers.push_back (new CompTimer ());
147 timers.back ()->setTimes (min, max);148 timers.back ()->setTimes (min, max);

Subscribers

People subscribed via source and target branches