Reformat code
This commit is contained in:
parent
e6119c0616
commit
e803de1004
@ -94,7 +94,7 @@ func (o *OpencvCameraPart) publishFrame(tickerTime time.Time) {
|
|||||||
msg := &events.FrameMessage{
|
msg := &events.FrameMessage{
|
||||||
Id: &events.FrameRef{
|
Id: &events.FrameRef{
|
||||||
Name: "camera",
|
Name: "camera",
|
||||||
Id: fmt.Sprintf("%d%000d", tickerTime.Unix(), tickerTime.Nanosecond() / 1000 / 1000),
|
Id: fmt.Sprintf("%d%000d", tickerTime.Unix(), tickerTime.Nanosecond()/1000/1000),
|
||||||
CreatedAt: ×tamp.Timestamp{
|
CreatedAt: ×tamp.Timestamp{
|
||||||
Seconds: tickerTime.Unix(),
|
Seconds: tickerTime.Unix(),
|
||||||
Nanos: int32(tickerTime.Nanosecond()),
|
Nanos: int32(tickerTime.Nanosecond()),
|
||||||
|
@ -30,14 +30,14 @@ func (f fakeVideoSource) Read(dest *gocv.Mat) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func TestOpencvCameraPart(t *testing.T) {
|
func TestOpencvCameraPart(t *testing.T) {
|
||||||
var muPubEvents sync.Mutex
|
var muPubEvents sync.Mutex
|
||||||
publishedEvents := make(map[string]*[]byte)
|
publishedEvents := make(map[string]*[]byte)
|
||||||
oldPublish := publish
|
oldPublish := publish
|
||||||
defer func() {
|
defer func() {
|
||||||
publish = oldPublish}()
|
publish = oldPublish
|
||||||
publish = func(_ mqtt.Client, topic string, payload *[]byte){
|
}()
|
||||||
|
publish = func(_ mqtt.Client, topic string, payload *[]byte) {
|
||||||
muPubEvents.Lock()
|
muPubEvents.Lock()
|
||||||
defer muPubEvents.Unlock()
|
defer muPubEvents.Unlock()
|
||||||
publishedEvents[topic] = payload
|
publishedEvents[topic] = payload
|
||||||
@ -54,7 +54,6 @@ func TestOpencvCameraPart(t *testing.T) {
|
|||||||
imgBuffered: &imgBuffer,
|
imgBuffered: &imgBuffer,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
go part.Start()
|
go part.Start()
|
||||||
time.Sleep(5 * time.Millisecond)
|
time.Sleep(5 * time.Millisecond)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user