aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data
diff options
context:
space:
mode:
authorSean Dague2008-11-04 18:53:06 +0000
committerSean Dague2008-11-04 18:53:06 +0000
commit45dd97a262561648efb39a1568ddef827ff5e744 (patch)
treecb62490f1c274f00f7c1f67c2a7d74e37b7818f3 /OpenSim/Data
parent* Stop sending wearables back to the client on set appearance (diff)
downloadopensim-SC_OLD-45dd97a262561648efb39a1568ddef827ff5e744.zip
opensim-SC_OLD-45dd97a262561648efb39a1568ddef827ff5e744.tar.gz
opensim-SC_OLD-45dd97a262561648efb39a1568ddef827ff5e744.tar.bz2
opensim-SC_OLD-45dd97a262561648efb39a1568ddef827ff5e744.tar.xz
- Stronger inventory tests
From: Arthur Rodrigo S Valadares <arthursv@linux.vnet.ibm.com>
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/Tests/BasicRegionTest.cs124
1 files changed, 119 insertions, 5 deletions
diff --git a/OpenSim/Data/Tests/BasicRegionTest.cs b/OpenSim/Data/Tests/BasicRegionTest.cs
index b480687..a259427 100644
--- a/OpenSim/Data/Tests/BasicRegionTest.cs
+++ b/OpenSim/Data/Tests/BasicRegionTest.cs
@@ -103,9 +103,13 @@ namespace OpenSim.Data.Tests
103 // - store / retrieve parts in a scenegroup 012 103 // - store / retrieve parts in a scenegroup 012
104 // - store a prim with complete information for consistency check 013 104 // - store a prim with complete information for consistency check 013
105 // - update existing prims, make sure it sticks - 014 105 // - update existing prims, make sure it sticks - 014
106 // - add inventory items to prims make - 015 106 // - tests empty inventory - 020
107 // - remove inventory items make sure it sticks - 016 107 // - add inventory items to prims make - 021
108 // - remove prim, make sure it sticks - 020 108 // - retrieves the added item - 022
109 // - update inventory items to prims - 023
110 // - remove inventory items make sure it sticks - 024
111 // - checks if all parameters are persistent - 025
112 // - adds many items and see if it is handled correctly - 026
109 113
110 [Test] 114 [Test]
111 public void T001_LoadEmpty() 115 public void T001_LoadEmpty()
@@ -502,9 +506,22 @@ namespace OpenSim.Data.Tests
502 506
503 Assert.That(t.Name, Is.EqualTo(itemname1)); 507 Assert.That(t.Name, Is.EqualTo(itemname1));
504 } 508 }
509
510 [Test]
511 public void T023_PrimInventoryUpdate()
512 {
513 SceneObjectGroup sog = FindSOG("object1", region1);
514 TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1);
515
516 t.Name = "My New Name";
517 sog.UpdateInventoryItem(t);
518
519 Assert.That(t.Name, Is.EqualTo("My New Name"));
520
521 }
505 522
506 [Test] 523 [Test]
507 public void T022_PrimInvetoryRemove() 524 public void T024_PrimInventoryRemove()
508 { 525 {
509 List<TaskInventoryItem> list = new List<TaskInventoryItem>(); 526 List<TaskInventoryItem> list = new List<TaskInventoryItem>();
510 db.StorePrimInventory(prim1, list); 527 db.StorePrimInventory(prim1, list);
@@ -513,6 +530,104 @@ namespace OpenSim.Data.Tests
513 TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1); 530 TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1);
514 Assert.That(t, Is.Null); 531 Assert.That(t, Is.Null);
515 } 532 }
533
534 [Test]
535 public void T025_PrimInventoryPersistency()
536 {
537 InventoryItemBase i = new InventoryItemBase();
538 UUID id = UUID.Random();
539 i.ID = id;
540 UUID folder = UUID.Random();
541 i.Folder = folder;
542 UUID owner = UUID.Random();
543 i.Owner = owner;
544 UUID creator = UUID.Random();
545 i.Creator = creator;
546 string name = RandomName();
547 i.Name = name;
548 i.Description = name;
549 UUID assetid = UUID.Random();
550 i.AssetID = assetid;
551 int invtype = random.Next();
552 i.InvType = invtype;
553 uint nextperm = (uint) random.Next();
554 i.NextPermissions = nextperm;
555 uint curperm = (uint) random.Next();
556 i.CurrentPermissions = curperm;
557 uint baseperm = (uint) random.Next();
558 i.BasePermissions = baseperm;
559 uint eoperm = (uint) random.Next();
560 i.EveryOnePermissions = eoperm;
561 int assettype = random.Next();
562 i.AssetType = assettype;
563 UUID groupid = UUID.Random();
564 i.GroupID = groupid;
565 bool groupown = true;
566 i.GroupOwned = groupown;
567 int saleprice = random.Next();
568 i.SalePrice = saleprice;
569 byte saletype = (byte) random.Next(255);
570 i.SaleType = saletype;
571 uint flags = (uint) random.Next();
572 i.Flags = flags;
573 int creationd = random.Next();
574 i.CreationDate = creationd;
575
576 SceneObjectGroup sog = FindSOG("object1", region1);
577 Assert.That(sog.AddInventoryItem(null, sog.RootPart.LocalId, i, zero), Is.True);
578 TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, id);
579
580 Assert.That(t.Name, Is.EqualTo(name));
581 Assert.That(t.AssetID,Is.EqualTo(assetid));
582 Assert.That(t.BasePermissions,Is.EqualTo(baseperm));
583 Assert.That(t.CreationDate,Is.EqualTo(creationd));
584 Assert.That(t.CreatorID,Is.EqualTo(creator));
585 Assert.That(t.Description,Is.EqualTo(name));
586 Assert.That(t.EveryonePermissions,Is.EqualTo(eoperm));
587 Assert.That(t.Flags,Is.EqualTo(flags));
588 Assert.That(t.GroupID,Is.EqualTo(sog.RootPart.GroupID));
589 // Where is this group permissions??
590 //Assert.That(t.GroupPermissions,Is.EqualTo());
591 Assert.That(t.InvType,Is.EqualTo(invtype));
592 Assert.That(t.ItemID,Is.EqualTo(id));
593 Assert.That(t.LastOwnerID, Is.EqualTo(sog.RootPart.LastOwnerID));
594 Assert.That(t.NextPermissions, Is.EqualTo(nextperm));
595 Assert.That(t.OwnerID,Is.EqualTo(owner));
596 Assert.That(t.CurrentPermissions, Is.EqualTo(curperm));
597 Assert.That(t.ParentID,Is.EqualTo(sog.RootPart.FolderID));
598 Assert.That(t.ParentPartID,Is.EqualTo(sog.RootPart.UUID));
599 }
600
601 [Test]
602 [ExpectedException(typeof(System.ArgumentException))]
603 public void T026_PrimInventoryMany()
604 {
605 UUID i1,i2,i3,i4;
606 i1 = UUID.Random();
607 i2 = UUID.Random();
608 i3 = UUID.Random();
609 i4 = i3;
610 InventoryItemBase ib1 = NewItem(i1, zero, zero, RandomName(), zero);
611 InventoryItemBase ib2 = NewItem(i2, zero, zero, RandomName(), zero);
612 InventoryItemBase ib3 = NewItem(i3, zero, zero, RandomName(), zero);
613 InventoryItemBase ib4 = NewItem(i4, zero, zero, RandomName(), zero);
614
615 SceneObjectGroup sog = FindSOG("object1", region1);
616
617 Assert.That(sog.AddInventoryItem(null, sog.RootPart.LocalId, ib1, zero), Is.True);
618 Assert.That(sog.AddInventoryItem(null, sog.RootPart.LocalId, ib2, zero), Is.True);
619 Assert.That(sog.AddInventoryItem(null, sog.RootPart.LocalId, ib3, zero), Is.True);
620 Assert.That(sog.AddInventoryItem(null, sog.RootPart.LocalId, ib4, zero), Is.True);
621
622 TaskInventoryItem t1 = sog.GetInventoryItem(sog.RootPart.LocalId, i1);
623 Assert.That(t1.Name, Is.EqualTo(ib1.Name));
624 TaskInventoryItem t2 = sog.GetInventoryItem(sog.RootPart.LocalId, i2);
625 Assert.That(t2.Name, Is.EqualTo(ib2.Name));
626 TaskInventoryItem t3 = sog.GetInventoryItem(sog.RootPart.LocalId, i3);
627 Assert.That(t3.Name, Is.EqualTo(ib3.Name));
628 TaskInventoryItem t4 = sog.GetInventoryItem(sog.RootPart.LocalId, i4);
629 Assert.That(t4, Is.Null);
630 }
516 631
517 [Test] 632 [Test]
518 public void T051_RemoveObjectWrongRegion() 633 public void T051_RemoveObjectWrongRegion()
@@ -679,7 +794,6 @@ namespace OpenSim.Data.Tests
679 sop.UUID = uuid; 794 sop.UUID = uuid;
680 sop.Shape = PrimitiveBaseShape.Default; 795 sop.Shape = PrimitiveBaseShape.Default;
681 796
682
683 SceneObjectGroup sog = new SceneObjectGroup(); 797 SceneObjectGroup sog = new SceneObjectGroup();
684 sog.AddPart(sop); 798 sog.AddPart(sop);
685 sog.RootPart = sop; 799 sog.RootPart = sop;