Closed Bug 996070 Opened 10 years ago Closed 10 years ago

APZ gtests use EXPECT_EQ backwards

Categories

(Core :: Panning and Zooming, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla31

People

(Reporter: botond, Assigned: botond)

Details

Attachments

(1 file)

The APZ gtests (gfc/tests/gtest/TestAsyncPanZoomController.cpp) use gtest's EXPECT_EQ macro for assertions.

The signature of this macro is "EXPECT_EQ(expected, actual)", that is, the first argument is the expected value being tested against, and the second argument is the value being tested.

These tests, however, use the macro backwards. For example, in ApzcPan(), we have an assertion of the form:

EXPECT_EQ(status, touchMoveStatus);

Here, 'touchMoveStatus' is the status we're expecting, and 'status' is the actual return value of ReceiveInputEvent(), so the assertion should instead be written:

EXPECT_EQ(touchMoveStatus, status);

This matters because the test harness presents assertion failures like so:

/home/botond/dev/mozilla/central/gfx/tests/gtest/TestAsyncPanZoomController.cpp:215: Failure
Value of: touchMoveStatus
  Actual: 0
Expected: status
Which is: 1

'Actual' and 'Expected' being backwards here can be really confusing to someone trying to debug a test failure.
Attached patch bug996070.patchSplinter Review
Assignee: nobody → botond
Attachment #8407138 - Flags: review?(bugmail.mozilla)
Attachment #8407138 - Flags: review?(bugmail.mozilla) → review+
https://hg.mozilla.org/mozilla-central/rev/bfb975c73a50
Status: NEW → RESOLVED
Closed: 10 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla31
You need to log in before you can comment on or make changes to this bug.