Reformat code

This commit is contained in:
Cyrille Nofficial 2020-01-28 23:30:38 +01:00
parent e6119c0616
commit e803de1004
2 changed files with 7 additions and 8 deletions

View File

@ -94,7 +94,7 @@ func (o *OpencvCameraPart) publishFrame(tickerTime time.Time) {
msg := &events.FrameMessage{
Id: &events.FrameRef{
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: &timestamp.Timestamp{
Seconds: tickerTime.Unix(),
Nanos: int32(tickerTime.Nanosecond()),

View File

@ -30,14 +30,14 @@ func (f fakeVideoSource) Read(dest *gocv.Mat) bool {
return true
}
func TestOpencvCameraPart(t *testing.T) {
var muPubEvents sync.Mutex
publishedEvents := make(map[string]*[]byte)
oldPublish := publish
defer func() {
publish = oldPublish}()
publish = func(_ mqtt.Client, topic string, payload *[]byte){
publish = oldPublish
}()
publish = func(_ mqtt.Client, topic string, payload *[]byte) {
muPubEvents.Lock()
defer muPubEvents.Unlock()
publishedEvents[topic] = payload
@ -54,7 +54,6 @@ func TestOpencvCameraPart(t *testing.T) {
imgBuffered: &imgBuffer,
}
go part.Start()
time.Sleep(5 * time.Millisecond)