Esempio n. 1
0
        void LoadFile(CoverageView.ClassItem klass)
        {
            int[] coverage = klass.Model.sourceFile.Coverage;

            StreamReader infile = new StreamReader(klass.Model.sourceFile.sourceFile);
            int          pos    = 1;

            while (infile.Peek() > -1)
            {
                TextIter end = text_buffer.EndIter;
                text_buffer.Insert(ref end, String.Format("{0, 6}  {1}\n", pos, infile.ReadLine()));

                if (pos < coverage.Length)
                {
                    int      count      = coverage [pos];
                    TextIter text_end   = text_buffer.EndIter;
                    TextIter text_start = text_end;
                    text_start.BackwardLines(1);

                    if (count > 0)
                    {
                        text_buffer.ApplyTag(hit_color, text_start, text_end);
                    }
                    else if (count == 0)
                    {
                        text_buffer.ApplyTag(missed_color, text_start, text_end);
                    }
                }
                pos++;
            }
        }
Esempio n. 2
0
        public SourceWindow(CoverageView.ClassItem klass)
        {
            this.classItem = klass;
            text_buffer = new TextBuffer (new TextTagTable ());
            text_view = new TextView (text_buffer);
            text_view.Editable = false;

            Add (text_view);

            hit_color = new TextTag ("hit");
            hit_color.Foreground = "blue";
            text_buffer.TagTable.Add (hit_color);
            missed_color = new TextTag ("miss");
            missed_color.Foreground = "red";
            text_buffer.TagTable.Add (missed_color);
            LoadFile (klass);
            ShowAll ();
        }
Esempio n. 3
0
        public SourceWindow(CoverageView.ClassItem klass)
            : base(klass.Model.sourceFile.sourceFile)
        {
            SetDefaultSize(800, 600);

            ScrolledWindow sw = new ScrolledWindow();

            text_buffer        = new TextBuffer(new TextTagTable());
            text_view          = new TextView(text_buffer);
            text_view.Editable = false;

            sw.Add(text_view);
            Add(sw);

            hit_color            = new TextTag("hit");
            hit_color.Foreground = "blue";
            text_buffer.TagTable.Add(hit_color);
            missed_color            = new TextTag("miss");
            missed_color.Foreground = "red";
            text_buffer.TagTable.Add(missed_color);
            LoadFile(klass);
            ShowAll();
        }