Skip to content

Commit

Permalink
use test.ShouldNotPanic
Browse files Browse the repository at this point in the history
  • Loading branch information
bazile-clyde committed Jan 24, 2023
1 parent 37536a9 commit 5172a18
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions rimage/transform/pinhole_camera_parameters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ import (
"image"
"testing"

"go.viam.com/rdk/pointcloud"

"github.com/golang/geo/r3"
"go.viam.com/test"
"go.viam.com/utils/artifact"
"go.viam.com/utils/testutils"

"go.viam.com/rdk/pointcloud"
"go.viam.com/rdk/rimage"
"go.viam.com/rdk/spatialmath"
"go.viam.com/rdk/utils"
Expand Down Expand Up @@ -210,13 +209,11 @@ func TestGetCameraMatrix(t *testing.T) {

func TestNilIntrinsics(t *testing.T) {
var nilIntrinsics *PinholeCameraIntrinsics

// should not panic
nilIntrinsics.CheckValid()
nilIntrinsics.GetCameraMatrix()
nilIntrinsics.PixelToPoint(0.0, 0.0, 0.0)
nilIntrinsics.PointToPixel(0.0, 0.0, 0.0)
nilIntrinsics.ImagePointTo3DPoint(image.Point{}, rimage.Depth(0))
nilIntrinsics.RGBDToPointCloud(&rimage.Image{}, &rimage.DepthMap{})
nilIntrinsics.PointCloudToRGBD(pointcloud.PointCloud(nil))
test.That(t, func() { nilIntrinsics.CheckValid() }, test.ShouldNotPanic)
test.That(t, func() { nilIntrinsics.GetCameraMatrix() }, test.ShouldNotPanic)
test.That(t, func() { nilIntrinsics.PixelToPoint(0.0, 0.0, 0.0) }, test.ShouldNotPanic)
test.That(t, func() { nilIntrinsics.PointToPixel(0.0, 0.0, 0.0) }, test.ShouldNotPanic)
test.That(t, func() { nilIntrinsics.ImagePointTo3DPoint(image.Point{}, rimage.Depth(0)) }, test.ShouldNotPanic)
test.That(t, func() { nilIntrinsics.RGBDToPointCloud(&rimage.Image{}, &rimage.DepthMap{}) }, test.ShouldNotPanic)
test.That(t, func() { nilIntrinsics.PointCloudToRGBD(pointcloud.PointCloud(nil)) }, test.ShouldNotPanic)
}

0 comments on commit 5172a18

Please sign in to comment.