summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2011-05-06 00:06:23 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2011-05-06 00:06:23 +0200
commitfd0042f60382b8bfd3f1d64c5c9517bbd494bfc8 (patch)
tree9d435a6d458d693d78720aae57eefb188c97920f /test
parent8425b72b78b08573ed8341d958e17a47c4f8f415 (diff)
downloadffi-efl-fd0042f60382b8bfd3f1d64c5c9517bbd494bfc8.zip
ffi-efl-fd0042f60382b8bfd3f1d64c5c9517bbd494bfc8.tar.gz
edje updates
Diffstat (limited to 'test')
-rw-r--r--test/test_edje.rb71
1 files changed, 31 insertions, 40 deletions
diff --git a/test/test_edje.rb b/test/test_edje.rb
index 23d71f2..0a45037 100644
--- a/test/test_edje.rb
+++ b/test/test_edje.rb
@@ -1,15 +1,10 @@
#! /usr/bin/env ruby
# -*- coding: UTF-8 -*-
#
-require 'efl/eina'
-require 'efl/evas'
require 'efl/ecore'
require 'efl/ecore_evas'
require 'efl/edje'
#
-Efl::Eina::init
-Efl::Evas::init
-Efl::Ecore::init
Efl::EcoreEvas::init
Efl::Edje::init
#
@@ -18,18 +13,21 @@ HEIGHT=240
EDC_FILE=File.join '/tmp','edje_test.edc'
EDJE_FILE=File.join '/tmp','edje_test.edj'
#
-if not File.exists? EDJE_FILE
- File.open(EDC_FILE,'w') do |f| f << DATA.read end
- system "edje_cc #{EDC_FILE}"
-end
+puts "write #{EDC_FILE}"
+content = DATA.read
+File.open(EDC_FILE,'w') do |f| f << content end
+puts "compile #{EDJE_FILE}"
+system "edje_cc #{EDC_FILE}"
#
def create_my_group canvas, txt
- #edje = edje_object_add(canvas);
edje = canvas.edje_object_add
if not edje.file_set EDJE_FILE, "my_group"
puts "unable to open #{EDJE_FILE}"
exit 1
end
+ puts "file and group : #{edje.file_get.join ' ; ' }"
+ puts "key1 : #{Efl::Native.edje_file_data_get EDJE_FILE, "key1"}"
+ puts "key2 : #{Efl::Native.edje_object_data_get edje, "key2"}"
edje.part_text_set "text", txt unless txt.nil?
edje.move 0, 0
edje.resize WIDTH, HEIGHT
@@ -41,6 +39,7 @@ txt = ( ARGV.length>0 ? ARGV[0] : nil )
#
window = Efl::EcoreEvas::REcoreEvas.new { |w|
w.resize WIDTH, HEIGHT
+ w.move 100, 100
}
#
canvas = window.get
@@ -52,28 +51,33 @@ Efl::Ecore.main_loop_begin
edje.free
window.free
#
+Efl::Edje::shutdown
+Efl::EcoreEvas::shutdown
__END__
-// compile: edje_cc edje_example.edc
+data {
+ item: "key1" "val1";
+}
collections {
group {
- name: "my_group"; // must be the same as in edje_example.c
+ name: "my_group";
+ data {
+ item: "key2" "val2";
+ }
parts {
part {
name: "background";
- type: RECT; // plain boring rectangle
- mouse_events: 0; // we don't need any mouse event on the background
- // just one state "default"
+ type: RECT;
+ mouse_events: 0;
description {
- state: "default" 0.0; // must always exist
- color: 255 255 255 255; // white
- // define part coordinates:
- rel1 { // top-left point at (0, 0) [WIDTH * 0 + 0, HEIGHT * 0 + 0]
+ state: "default" 0.0;
+ color: 255 255 255 255;
+ rel1 {
relative: 0.0 0.0;
offset: 0 0;
}
- rel2 { // bottom-right point at (WIDTH * 1.0 - 1, HEIGHT * 1.0 - 1)
+ rel2 {
relative: 1.0 1.0;
offset: -1 -1;
}
@@ -82,56 +86,43 @@ collections {
part {
name: "text";
type: TEXT;
- mouse_events: 1; // we want to change the color on mouse-over
- // 2 states, one "default" and another "over" to be used
- // on mouse over effect
+ mouse_events: 1;
description {
state: "default" 0.0;
- color: 255 0 0 255; // red
- // define part coordinates:
- rel1 { // top-left at (WIDTH * 0.1 + 5, HEIGHT * 0.2 + 10)
+ color: 255 0 0 255;
+ rel1 {
relative: 0.1 0.2;
offset: 5 10;
}
- rel2 { // bottom-right at (WIDTH * 0.9 - 6, HEIGHT * 0.8 - 11)
+ rel2 {
relative: 0.9 0.8;
offset: -6 -11;
}
- // define text specific state details
text {
- font: "Sans"; /* using fontconfig name! */
+ font: "Sans";
size: 10;
text: "hello world";
}
}
description {
state: "over" 0.0;
- inherit: "default" 0.0; // copy everything from "default" at this point
- color: 0 255 0 255; // override color, now it is green
+ inherit: "default" 0.0;
+ color: 0 255 0 255;
}
}
- // do programs to change color on text mouse in/out (over)
programs {
program {
- // what triggers this program:
signal: "mouse,in";
source: "text";
- // what this program does:
action: STATE_SET "over" 0.0;
target: "text";
- // do the state-set in a nice interpolation animation
- // using linear time in 0.1 second
transition: LINEAR 0.1;
}
program {
- // what triggers this program:
signal: "mouse,out";
source: "text";
- // what this program does:
action: STATE_SET "default" 0.0;
target: "text";
- // do the state-set in a nice interpolation animation
- // using linear time in 0.1 second
transition: LINEAR 0.1;
}
}