Example #1
0
        public void Test_ViewModel_Change()
        {
            var view = new ViewModel();

            hasChanged = new Dictionary<string, bool>();
            hasChanged["Display"] = false;
            view.PropertyChanged += View_PropertyChanged;

            Assert.IsFalse(hasChanged["Display"]);

            Assert.IsTrue(hasChanged["Display"]);
            view.Text = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.";
            hasChanged["Display"] = false;

            view.Width = 10;
            Assert.IsTrue(hasChanged["Display"]);
        }
Example #2
0
        public MainWindow()
        {
            InitializeComponent();

            ViewModel vm = new ViewModel();

            // We bind the Display property to the cellTable grid.
            // Workaround since we can't directly bind grid colum/row definitions
            vm.PropertyChanged += (s, e)=>
            {
                if (e.PropertyName == "Display")
                    GridDisplay.Update(this.cellTable, vm.Table, vm.Path);
            };

            this.DataContext = vm;

            // Initialize grid display
            GridDisplay.Update(this.cellTable, vm.Table, vm.Path);
        }
Example #3
0
        public void Test_ViewModel()
        {
            var view = new ViewModel();

            view.Text = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.";
            view.PercentageWidth = 0.5;

            Assert.AreEqual(view.Table.Length, 95);
            Assert.AreEqual(view.Width, 5);
            Assert.AreEqual(view.Height, 19);
            Assert.AreEqual(view.Path.Count, 19);

            view.PercentageWidth = 9;
            Assert.AreEqual(view.Table.Length, 164);
            Assert.AreEqual(view.Width, 82);
            Assert.AreEqual(view.Height, 2);
            Assert.AreEqual(view.Path.Count, 9);

            view.Width = 10;
            Assert.AreEqual(view.Table.Length, 100);
            Assert.AreEqual(view.Width, 10);
            Assert.AreEqual(view.Height, 10);
            Assert.AreEqual(view.Path.Count, 10);
        }