コード例 #1
0
		public void SetUpFixture()
		{
			resourceWriter = new MockResourceWriter();
			resourceService = new MockResourceService();
			resourceService.SetResourceWriter(resourceWriter);
			
			AvalonEdit.TextEditor textEditor = new AvalonEdit.TextEditor();
			document = textEditor.Document;
			textEditor.Text = GetTextEditorCode();
			
			PythonParser parser = new PythonParser();
			ICompilationUnit compilationUnit = parser.Parse(new DefaultProjectContent(), @"test.py", document.Text);

			using (DesignSurface designSurface = new DesignSurface(typeof(Form))) {
				IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost));
				Form form = (Form)host.RootComponent;
				form.ClientSize = new Size(499, 309);

				PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form);
				PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false);
				namePropertyDescriptor.SetValue(form, "MainForm");
				
				DesignerSerializationManager serializationManager = new DesignerSerializationManager(host);
				using (serializationManager.CreateSession()) {
					AvalonEditDocumentAdapter adapter = new AvalonEditDocumentAdapter(document, null);
					MockTextEditorOptions options = new MockTextEditorOptions();
					PythonDesignerGenerator generator = new PythonDesignerGenerator(options);
					generator.Merge(host, adapter, compilationUnit, serializationManager);
				}
			}
		}
コード例 #2
0
		void CreatePythonFormattingStrategy()
		{
			MockTextEditorOptions textEditorOptions = new MockTextEditorOptions();
			textEditorOptions.IndentationSize = 4;
			textEditor = new TextEditor();
			textEditor.Options = textEditorOptions;
			
			textEditorAdapter = new AvalonEditTextEditorAdapter(textEditor);
			formattingStrategy = new PythonFormattingStrategy();
		}
コード例 #3
0
		void CreateDesignerGenerator()
		{
			textEditorViewContent = new MockTextEditorViewContent();
			formsDesignerOpenedFile = new MockOpenedFile("test.py");
			textEditorViewContent.PrimaryFile = formsDesignerOpenedFile;
			formsDesignerView = new FormsDesignerViewContent(textEditorViewContent, formsDesignerOpenedFile);
			textEditorOptions = new MockTextEditorOptions();
			generator = new TestableScriptingDesignerGenerator(textEditorOptions);
			generator.Attach(formsDesignerView);
			generator.ParseInfoToReturnFromParseFile = generator.CreateParseInfoWithOneClass();
		}
コード例 #4
0
		public void SetUpFixture()
		{
			textEditorOptions = new MockTextEditorOptions();
			generator = new DerivedRubyDesignerGenerator(textEditorOptions);
			mockViewContent = new MockTextEditorViewContent();
			viewContent = new DerivedFormDesignerViewContent(mockViewContent, new MockOpenedFile(fileName));
			generator.Attach(viewContent);
			viewContent.DesignerCodeFileContent = GetTextEditorCode();
			
			RubyParser parser = new RubyParser();
			ICompilationUnit parserCompilationUnit = parser.Parse(new DefaultProjectContent(), fileName, GetTextEditorCode());
			ParseInformation parseInfo = new ParseInformation(parserCompilationUnit);
			generator.ParseInfoToReturnFromParseFileMethod = parseInfo;
			
			AfterSetUpFixture();
		}
		public void SetUpFixture()
		{
			AvalonEdit.TextEditor textEditor = new AvalonEdit.TextEditor();
			document = textEditor.Document;
			textEditor.Text = GetTextEditorCode();

			RubyParser parser = new RubyParser();
			MockProjectContent projectContent = new MockProjectContent();
			MockProject project = new MockProject();
			project.RootNamespace = "RootNamespace";
			projectContent.Project = project;
			ICompilationUnit compilationUnit = parser.Parse(projectContent, @"test.py", document.Text);

			using (DesignSurface designSurface = new DesignSurface(typeof(Form))) {
				IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost));
				IEventBindingService eventBindingService = new MockEventBindingService(host);
				Form form = (Form)host.RootComponent;
				form.ClientSize = new Size(200, 300);

				PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form);
				PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false);
				namePropertyDescriptor.SetValue(form, "MainForm");
			
				// Add picture box
				PictureBox pictureBox = (PictureBox)host.CreateComponent(typeof(PictureBox), "pictureBox1");
				pictureBox.Location = new Point(0, 0);
				pictureBox.Image = new Bitmap(10, 10);
				pictureBox.Size = new Size(100, 120);
				pictureBox.TabIndex = 0;
				form.Controls.Add(pictureBox);
				
				MockTextEditorOptions options = new MockTextEditorOptions();
				options.ConvertTabsToSpaces = true;
				options.IndentationSize = 4;
				
				DesignerSerializationManager serializationManager = new DesignerSerializationManager(host);
				using (serializationManager.CreateSession()) {
					AvalonEditDocumentAdapter docAdapter = new AvalonEditDocumentAdapter(document, null);
					RubyDesignerGenerator generator = new RubyDesignerGenerator(options);
					generator.Merge(host, docAdapter, compilationUnit, serializationManager);
				}
			}
		}
コード例 #6
0
		public void Init()
		{
			MockTextEditorOptions options = new MockTextEditorOptions();
			generator = new RubyDesignerGenerator(options);
		}