go-qml / qml

QML support for the Go language
Other
1.96k stars 187 forks source link

Test "Custom Go type with painting" failing on HasLen 1 #73

Open pebbe opened 10 years ago

pebbe commented 10 years ago

I have the latest version of qml, but this error happened with older versions too.

I have Qt version 5.0.2. Go version go1.3rc1 linux/amd64 (but error also with older version), gcc version 4.8.2

Test log:

=== RUN Test

----------------------------------------------------------------------
FAIL: qml_test.go:1183: S.TestTable

----- Running table test 0: Read a context variable and its fields -----
[LOG] 36.85478 file.qml:5: String is <content>
[LOG] 36.85478 file.qml:6: Int is 42
[LOG] 36.85478 file.qml:7: Any is undefined
----- Running table test 1: Read a nested field via a value (not pointer) in an interface -----
[LOG] 36.85478 file.qml:3: String is <content>
----- Running table test 2: Read a native property -----
----- Running table test 3: Read object properties -----
----- Running table test 4: Lowercasing of object properties -----
[LOG] 36.85478 file.qml:3: Names are <a> <b> <c> <d>
----- Running table test 5: No access to private fields -----
[LOG] 36.85478 file.qml:3: Private is undefined
----- Running table test 6: Set a custom property -----
[LOG] 36.85478 file.qml:6: file:////home/peter/go/src/gopkg.in/qml.v0/file.qml:6: TypeError: Cannot read property 'stringValue' of null
[LOG] 36.85478 file.qml:6: String is <content>
[LOG] 36.85478 file.qml:7: Width is 300
[LOG] 36.85478 file.qml:8: Height is 200
----- Running table test 7: Read and set a QUrl property -----
----- Running table test 8: Read and set a QColor property -----
----- Running table test 9: Read and set a QColor property from a Go field -----
[LOG] 36.85478 file.qml:3: #102040
----- Running table test 10: Read a QQmlListProperty property into a Go slice -----
----- Running table test 11: Read a QQmlListReference property into a Go slice -----
----- Running table test 12: Read a QVariantList property into a Go slice -----
----- Running table test 13: Set a Go slice property -----
----- Running table test 14: Set a Go slice property with objects -----
----- Running table test 15: Call a method with a JSON object (issue #48) -----
----- Running table test 16: Read a map from a QML property -----
----- Running table test 17: Identical values remain identical when possible -----
[LOG] 36.85478 file.qml:3: Identical: true
----- Running table test 18: Object finding via objectName -----
----- Running table test 19: Register Go type -----
[LOG] 36.85478 file.qml:3: String is <initial>
----- Running table test 20: Register Go type with an explicit name -----
[LOG] 36.85478 file.qml:3: String is <initial>
----- Running table test 21: Write Go type property -----
----- Running table test 22: Write Go type property that has a setter -----
----- Running table test 23: Write Go type property that has a setter and a getter -----
[LOG] 36.85478 file.qml:5: Getter returned <content>
----- Running table test 24: Write an inline object list to a Go type property -----
[LOG] 36.85478 file.qml:6: Length: 2
[LOG] 36.85478 file.qml:7: Name: on
----- Running table test 25: Write an inline object list to a Go type property that has a setter -----
----- Running table test 26: Clear an object list in a Go type property -----
----- Running table test 27: Clear an object list in a Go type property that has a setter -----
----- Running table test 28: Access underlying Go value with Interface -----
----- Running table test 29: Notification signals on custom Go type -----
----- Running table test 30: Singleton type registration -----
[LOG] 36.85478 file.qml:3: String is <initial>
----- Running table test 31: qml.Changed on unknown value is okay -----
----- Running table test 32: qml.Changed triggers a QML slot -----
[LOG] 36.85478 file.qml:5: String is <new>
[LOG] 36.85478 file.qml:6: String at addr is <new at addr>
----- Running table test 33: qml.Changed must not trigger on the wrong field -----
----- Running table test 34: qml.Changed updates bindings -----
----- Running table test 35: Call a Go method without arguments or result -----
[LOG] 36.85478 file.qml:3: Undefined is undefined
----- Running table test 36: Call a Go method with one argument and one result -----
[LOG] 36.85478 file.qml:3: String was <old>
----- Running table test 37: Call a Go method with multiple results -----
[LOG] 36.85478 file.qml:6: mod is 2 and err is undefined
----- Running table test 38: Call a Go method that returns an error -----
[LOG] 36.85478 file.qml:6: err is <division by zero>
----- Running table test 39: Call a Go method that recurses back into the GUI thread -----
[LOG] 36.85478 file.qml:6: Notification arrived
----- Running table test 40: Connect a QML signal to a Go method -----
----- Running table test 41: Call a QML method with no result or parameters from Go -----
[LOG] 36.85478 file.qml:3: f was called
----- Running table test 42: Call a QML method with result and parameters from Go -----
----- Running table test 43: Call a QML method with a custom type -----
[LOG] 36.85478 file.qml:3: String is <content>
----- Running table test 44: Call a QML method that returns a QML object -----
----- Running table test 45: Call a QML method that holds a custom type past the return point -----
[LOG] 36.85478 file.qml:6: String is <content>
----- Running table test 46: Call a non-existent QML method -----
----- Running table test 47: Ensure URL of provided file is correct by loading a local file -----
[LOG] 36.85478 file.qml:3: Ready: true
----- Running table test 48: Create window with non-window root object -----
----- Running table test 49: Create window with window root object -----
----- Running table test 50: Window is object -----
----- Running table test 51: Pass a *Value back into a method -----
[LOG] 36.85478 file.qml:3: Width is 300
----- Running table test 52: Create a QML-defined component in Go -----
----- Running table test 53: Call a Qt method that has no result -----
[LOG] 36.85478 file.qml:3: item destroyed
[LOG] 36.85478 file.qml:3: item destroyed
----- Running table test 54: Errors connecting to QML signals -----
----- Running table test 55: Connect to a QML signal without parameters -----
----- Running table test 56: Connect to a QML signal with a parameters -----
----- Running table test 57: Connect to a QML signal with an object parameter -----
----- Running table test 58: Load image from Go provider -----
[LOG] 36.85478 file.qml:5: Size: 200 100
----- Running table test 59: TypeName -----
----- Running table test 60: Custom Go type with painting -----
qml_test.go:1287:
    t.Done(&testData)
qml_test.go:1105:
    c.Assert(c.createdRect, HasLen, 1)
... obtained []*qml_test.GoRect = []*qml_test.GoRect(nil)
... n int = 1

OOPS: 9 passed, 1 FAILED
--- FAIL: Test (7.62 seconds)
FAIL
exit status 1
FAIL    gopkg.in/qml.v0 7.635s
pebbe commented 10 years ago

I get the same output with go version go1.3.1 linux/amd64 and gopkg.in/qml.v1

niemeyer commented 10 years ago

The string reported in the summary is not an error. The test actually passes.

The issue is at the bottom, on the test that checks that the custom rectangle is created ("Custom Go type with painting").

Can you please increase the delay on that test to a couple of seconds to make sure it's not a timing issue? If it is, I'll change the test to make it consistently more reliable.

pebbe commented 10 years ago

I increased the Sleep from 100 to 1000 milliseconds. Now all tests pass.

niemeyer commented 10 years ago

Thanks. I'll have a closer look at that test and make it more reliable.