aboutsummaryrefslogtreecommitdiffstats
path: root/len_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'len_test.go')
-rw-r--r--len_test.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/len_test.go b/len_test.go
new file mode 100644
index 0000000..91b0886
--- /dev/null
+++ b/len_test.go
@@ -0,0 +1,16 @@
+package gui_test
+
+import (
+ "fmt"
+ "image"
+
+ "github.com/faiface/gui"
+)
+
+func ExampleRelative() {
+ var l Length = Relative(0.10) // 10%
+ r := image.Rect(0, 0, 100, 100) // 100x100 rectangle
+ fmt.Println(l.Px(r))
+ // Output:
+ // 10
+}