summaryrefslogtreecommitdiff
path: root/src/tests/efl_mono/Eo.cs
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2019-12-20 01:35:23 +0000
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2019-12-23 13:50:12 -0300
commit0954e501fd4008c40b3848de1f2c91bcd53b2f71 (patch)
tree3b6e45b69d24c85fcd0463eb605837cebe410c6a /src/tests/efl_mono/Eo.cs
parented0572a33a28429f1ad6e47cb5bee9ef816e4a45 (diff)
csharp: Property Indexer implementation
Use Indexers to use brackets, eg [i], syntax. Keys now can be used as following: var someVal = obj.SomeProperty[key]; obj.SomeProperty[key] = someNewVal; And for multiple keys: var someVal = obj.SomeProperty[(key1, key2)]; obj.SomeProperty[(key1, key2)] = someNewVal; T8384 Reviewed-by: WooHyun Jung <wh0705.jung@samsung.com> Differential Revision: https://phab.enlightenment.org/D10791
Diffstat (limited to 'src/tests/efl_mono/Eo.cs')
-rw-r--r--src/tests/efl_mono/Eo.cs62
1 files changed, 54 insertions, 8 deletions
diff --git a/src/tests/efl_mono/Eo.cs b/src/tests/efl_mono/Eo.cs
index 7c580480ad..af40bf12d8 100644
--- a/src/tests/efl_mono/Eo.cs
+++ b/src/tests/efl_mono/Eo.cs
@@ -402,15 +402,15 @@ class TestCsharpProperties
402 obj.Dispose(); 402 obj.Dispose();
403 } 403 }
404 404
405 public static void test_setter_only() 405 // public static void test_setter_only()
406 { 406 // {
407 var obj = new Dummy.TestObject(); 407 // var obj = new Dummy.TestObject();
408 int val = -1984; 408 // int val = -1984;
409 409
410 obj.SetterOnly = val; 410 // obj.SetterOnly = val;
411 Test.AssertEquals(val, obj.GetSetterOnly()); 411 // Test.AssertEquals(val, obj.GetSetterOnly());
412 obj.Dispose(); 412 // obj.Dispose();
413 } 413 // }
414 414
415 public static void test_class_property() 415 public static void test_class_property()
416 { 416 {
@@ -436,6 +436,52 @@ class TestCsharpProperties
436 Test.AssertEquals(ret, (1, 2)); 436 Test.AssertEquals(ret, (1, 2));
437 obj.Dispose(); 437 obj.Dispose();
438 } 438 }
439
440 public static void test_csharp_keyed_multi_valued_prop()
441 {
442 var obj = new Dummy.TestObject();
443 obj.KeyedMultiValuedProp[100] = (1, 2);
444 Test.AssertEquals(obj.KeyedMultiValuedProp[100], (1, 2));
445 obj.Dispose();
446 }
447
448 public static void test_csharp_multi_keyed_multi_valued_prop()
449 {
450 var obj = new Dummy.TestObject();
451 obj.MultiKeyedMultiValuedProp[(100, 101)] = (1, 2);
452 Test.AssertEquals(obj.MultiKeyedMultiValuedProp[(100, 101)], (1, 2));
453 obj.Dispose();
454 }
455
456 public static void test_csharp_multi_prop()
457 {
458 var obj = new Dummy.TestObject();
459 obj.MultiKeyedMultiValuedProp[(100, 101)] = (1, 2);
460 obj.KeyedMultiValuedProp[100] = (1, 2);
461 Test.AssertEquals(obj.KeyedMultiValuedProp[100],
462 obj.MultiKeyedMultiValuedProp[(100, 101)]);
463 int a1, b1, a2, b2;
464#if __MonoCS__
465 (int a, int b) t1 = obj.MultiKeyedMultiValuedProp[(100, 101)];
466 (a1, b1) = (t1.Item1, t1.Item2);
467 (int a, int b) t2 = obj.KeyedMultiValuedProp[100];
468 (a2, b2) = (t2.Item1, t2.Item2);
469#else
470 (a1, b1) = obj.MultiKeyedMultiValuedProp[(100, 101)];
471 (a2, b2) = obj.KeyedMultiValuedProp[100];
472#endif
473 Test.AssertEquals(a1, a2);
474 Test.AssertEquals(b1, b2);
475 var i = (100, 101);
476 var j = 100;
477 Test.AssertEquals(obj.KeyedMultiValuedProp[j],
478 obj.MultiKeyedMultiValuedProp[i]);
479 obj.MultiKeyedMultiValuedProp[i] = (1, 3);
480 obj.KeyedMultiValuedProp[j] = obj.MultiKeyedMultiValuedProp[i];
481 Test.AssertEquals(obj.KeyedMultiValuedProp[j],
482 obj.MultiKeyedMultiValuedProp[i]);
483
484 }
439} 485}
440 486
441class TestEoGrandChildrenFinalize 487class TestEoGrandChildrenFinalize