Esempio n. 1
0
 public void findYTest()
 {
     PowerPoint.Shape shape = new MockShape();
     shape.Top = 50.3f;
     int id = 0;
     TildaShape target = new TildaShape(shape, id);
     double expected = shape.Top * Settings.Scaler();
     double actual;
     actual = target.findY();
     double difference = expected - actual;
     Assert.IsTrue(difference <= .00001);
 }
Esempio n. 2
0
        public void toRaphJSTest()
        {
            PowerPoint.Shape shape = new MockShape();
            int id = 0;
            TildaPicture target = new TildaPicture(shape, id);

            TildaShape[] shapeMap = new TildaShape[2];
            shapeMap[0] = target;
            shapeMap[0].shape.Width = 20f;
            shapeMap[0].shape.Height = 40f;
            shapeMap[0].shape.Top = 5f;
            shapeMap[0].shape.Left = 6f;
            shapeMap[1] = new TildaShape(new MockShape(), 1);
            shapeMap[1].shape.Width = 50f;
            shapeMap[1].shape.Height = 60f;

            List<TildaAnimation> animationMap = new List<TildaAnimation>();

            TildaSlide slide = new TildaSlide(new TildaTests.Mocks.MockSlide());
            string expected = @"preso.shapes.push\(preso.paper.image\('assets/[0-9]*-[0-9]*-image.png',"
                + shapeMap[0].position() + ","+(shapeMap[0].shape.Width*Settings.Scaler())+","+shapeMap[0].shape.Height*Settings.Scaler()+@"\)\);";
            string actual;

            //Assert.AreEqual(slide.shapeCount, 0);
            actual = target.toRaphJS();

            Boolean doesEqual = Regex.IsMatch(actual,expected);
            Assert.AreEqual(true, doesEqual);

            //Adding animations
            TildaAnimation anim = new TildaAnimation(new MockEffect(),shapeMap[0]);
            anim.effect.Timing.Duration = 5f;
            anim.effect.Timing.TriggerDelayTime = 15f;
            shapeMap[0].animations.Add(anim);

            expected = @"preso.shapes.push\(preso.paper.image\('assets/[0-9]*-[0-9]*-image.png',"
                + shapeMap[0].position() + "," + (shapeMap[0].shape.Width * Settings.Scaler()) + "," + shapeMap[0].shape.Height * Settings.Scaler() + @"\)\);"
                + @"preso.shapes\[\(preso.shapes.length-1\)\].attr\(\{'opacity':0\}\);preso.animations.push\(\{'ids':\[\(preso.shapes.length-1\)\],'dur':" + anim.effect.Timing.Duration * 1000
                + @",'delay':" + anim.effect.Timing.TriggerDelayTime * 1000 + @",animate:\{'opacity':1\}\}\);";
            actual = target.toRaphJS();
            doesEqual = Regex.IsMatch(actual, expected);
            Assert.AreEqual(true, doesEqual);
        }
Esempio n. 3
0
 public void nameTest()
 {
     TildaShape shape = new TildaShape(new MockShape(Microsoft.Office.Core.MsoShapeType.msoAutoShape));
     Assert.AreEqual(true, shape.name().Contains("autoshape"));
     shape = new TildaShape(new MockShape(Microsoft.Office.Core.MsoShapeType.msoCallout));
     Assert.AreEqual(true, shape.name().Contains("callout"));
     shape = new TildaShape(new MockShape(Microsoft.Office.Core.MsoShapeType.msoCanvas));
     Assert.AreEqual(true, shape.name().Contains("canvas"));
     shape = new TildaShape(new MockShape(Microsoft.Office.Core.MsoShapeType.msoChart));
     Assert.AreEqual(true, shape.name().Contains("chart"));
     shape = new TildaShape(new MockShape(Microsoft.Office.Core.MsoShapeType.msoComment));
     Assert.AreEqual(true, shape.name().Contains("comment"));
     shape = new TildaShape(new MockShape(Microsoft.Office.Core.MsoShapeType.msoDiagram));
     Assert.AreEqual(true, shape.name().Contains("diagram"));
     shape = new TildaShape(new MockShape(Microsoft.Office.Core.MsoShapeType.msoEmbeddedOLEObject));
     Assert.AreEqual(true, shape.name().Contains("embeddedoleobj"));
     shape = new TildaShape(new MockShape(Microsoft.Office.Core.MsoShapeType.msoFormControl));
     Assert.AreEqual(true, shape.name().Contains("formcontrol"));
     shape = new TildaShape(new MockShape(Microsoft.Office.Core.MsoShapeType.msoFreeform));
     Assert.AreEqual(true, shape.name().Contains("freeform"));
     shape = new TildaShape(new MockShape(Microsoft.Office.Core.MsoShapeType.msoGroup));
     Assert.AreEqual(true, shape.name().Contains("group"));
     shape = new TildaShape(new MockShape(Microsoft.Office.Core.MsoShapeType.msoInk));
     Assert.AreEqual(true, shape.name().Contains("ink"));
     shape = new TildaShape(new MockShape(Microsoft.Office.Core.MsoShapeType.msoInkComment));
     Assert.AreEqual(true, shape.name().Contains("inkcomment"));
     shape = new TildaShape(new MockShape(Microsoft.Office.Core.MsoShapeType.msoLine));
     Assert.AreEqual(true, shape.name().Contains("line"));
     shape = new TildaShape(new MockShape(Microsoft.Office.Core.MsoShapeType.msoLinkedOLEObject));
     Assert.AreEqual(true, shape.name().Contains("linkedoleobj"));
     shape = new TildaShape(new MockShape(Microsoft.Office.Core.MsoShapeType.msoLinkedPicture));
     Assert.AreEqual(true, shape.name().Contains("linkedpicture"));
     shape = new TildaShape(new MockShape(Microsoft.Office.Core.MsoShapeType.msoMedia));
     Assert.AreEqual(true, shape.name().Contains("media"));
     shape = new TildaShape(new MockShape(Microsoft.Office.Core.MsoShapeType.msoOLEControlObject));
     Assert.AreEqual(true, shape.name().Contains("olecontrolobject"));
     shape = new TildaShape(new MockShape(Microsoft.Office.Core.MsoShapeType.msoPicture));
     Assert.AreEqual(true, shape.name().Contains("picture"));
     shape = new TildaShape(new MockShape(Microsoft.Office.Core.MsoShapeType.msoPlaceholder));
     Assert.AreEqual(true, shape.name().Contains("placeholder"));
     shape = new TildaShape(new MockShape(Microsoft.Office.Core.MsoShapeType.msoScriptAnchor));
     Assert.AreEqual(true, shape.name().Contains("scriptanchor"));
     shape = new TildaShape(new MockShape(Microsoft.Office.Core.MsoShapeType.msoShapeTypeMixed));
     Assert.AreEqual(true, shape.name().Contains("shapetypemixed"));
     shape = new TildaShape(new MockShape(Microsoft.Office.Core.MsoShapeType.msoSlicer));
     Assert.AreEqual(true, shape.name().Contains("slicer"));
     shape = new TildaShape(new MockShape(Microsoft.Office.Core.MsoShapeType.msoSmartArt));
     Assert.AreEqual(true, shape.name().Contains("smartart"));
     shape = new TildaShape(new MockShape(Microsoft.Office.Core.MsoShapeType.msoTable));
     Assert.AreEqual(true, shape.name().Contains("table"));
     shape = new TildaShape(new MockShape(Microsoft.Office.Core.MsoShapeType.msoTextBox));
     Assert.AreEqual(true, shape.name().Contains("textbox"));
 }
Esempio n. 4
0
 public void toRaphJSTest()
 {
     PowerPoint.Shape shape = new MockShape();
     int id = 0;
     TildaShape target = new TildaShape(shape, id);
     string expected = string.Empty;
     string actual;
     actual = target.toRaphJS();
     Assert.AreEqual(expected, actual);
 }
Esempio n. 5
0
 public void TildaShapeConstructorTest()
 {
     PowerPoint.Shape shape = new MockShape();
     TildaShape target = new TildaShape(shape,0);
     Assert.AreEqual(shape, target.shape);
     Assert.AreEqual(Settings.Scaler(), target.scaler);
     Assert.AreEqual(0, target.id);
 }
Esempio n. 6
0
        public void RotationTest()
        {
            //create Shape
            PowerPoint.Shape shape = new MockShape();
            shape.Rotation = 90;
            //set attributes

            //compare
            String expected = "'transformation':'r90'";
            TildaShape target = new TildaShape(shape);
            String actual = target.transformation();
            Assert.AreEqual(expected, actual);
        }
Esempio n. 7
0
 public void rgbToHexTest()
 {
     TildaShape s = new TildaShape(new MockShape());
     Assert.AreEqual("#ffffff", s.rgbToHex(16777215));
     Assert.AreEqual("#ff0000", s.rgbToHex(16711680));
     Assert.AreEqual("#00ff00", s.rgbToHex(65280));
     Assert.AreEqual("#0000ff", s.rgbToHex(255));
     Assert.AreEqual("#ea7b5d", s.rgbToHex(15367005));
 }
Esempio n. 8
0
 public void positionTest()
 {
     PowerPoint.Shape shape = new MockShape();
     shape.Left = 30f;
     shape.Top = 55f;
     int id = 5;
     TildaShape target = new TildaShape(shape, id);
     string expected = (double)(shape.Left * Settings.Scaler()) + "," + (double)(shape.Top * Settings.Scaler());
     string actual;
     actual = target.position();
     Assert.AreEqual(expected, actual);
 }
Esempio n. 9
0
 public TildaAnimation(PowerPoint.Effect effect, TildaShape shape)
 {
     this.effect = effect;
     this.shape = shape;
 }
Esempio n. 10
0
 public TildaAnimation(PowerPoint.Effect effect, TildaShape shape)
 {
     this.effect = effect;
     this.shape  = shape;
 }