-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change aspect to AspectRatio() #635
Changes from 11 commits
df5d6d9
a7cdf54
9723e19
2286b60
8133de4
fbbbc4b
932053a
dcd5983
666638b
2ad35e3
8d4e542
545a534
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -178,6 +178,17 @@ void CameraTest::RenderTexture(const std::string &_renderEngine) | |||||||||||||||||||||||||||||
camera->SetImageHeight(80u); | ||||||||||||||||||||||||||||||
EXPECT_EQ(80u, camera->ImageHeight()); | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
double height = 80; | ||||||||||||||||||||||||||||||
camera->SetImageHeight(height); | ||||||||||||||||||||||||||||||
double aspectRatio = camera->ImageWidth() / height; | ||||||||||||||||||||||||||||||
EXPECT_NEAR(aspectRatio, camera->AspectRatio(), 1e-6); | ||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since your new tests are almost the same as the previous test, lets remove the new test and continue on the previous one. E.g.,
Suggested change
The same should be done for width. Also, go ahead and update this expectation below to use the new variables: gz-rendering/src/Camera_TEST.cc Line 195 in 8d4e542
e.g., |
||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
double width = 100; | ||||||||||||||||||||||||||||||
camera->SetImageWidth(width); | ||||||||||||||||||||||||||||||
aspectRatio = width / camera->ImageHeight(); | ||||||||||||||||||||||||||||||
EXPECT_NEAR(aspectRatio, camera->AspectRatio(), 1e-6); | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
EXPECT_NE(PixelFormat::PF_UNKNOWN, camera->ImageFormat()); | ||||||||||||||||||||||||||||||
camera->SetImageFormat(PixelFormat::PF_B8G8R8); | ||||||||||||||||||||||||||||||
EXPECT_EQ(PixelFormat::PF_B8G8R8, camera->ImageFormat()); | ||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume you are multiplying by
1.0
to cast the result to adouble
. It's better to usestatic_cast<double>
to be explicit with the cast making the purpose clear. Same forSetImageHeight