public void AdjustPaperSize() { CheckDisposed(); m_div.NumColumns = 2; m_pub.PageWidth = 50000; m_pub.PageHeight = 80000; m_dlg = new DummyPageSetupDlg(wsUser, m_pgl, m_pub, m_div, MsrSysType.Point, m_pubPageInfo); m_dlg.PageSizeComboIndex = 0; m_dlg.IsAllowNonStandardChecked = true; // Iterate through the paper sizes to make sure the appropriate name is selected in // the paper size combo box. We have to convert from 100ths of inches to millipoints. foreach (string paperSizeName in TestPaperSizes.Keys) { if (paperSizeName != ResourceHelper.GetResourceString("kstidPaperSizeCustom")) { PaperSize paperSize = TestPaperSizes[paperSizeName]; m_dlg.PaperSizeHeight = paperSize.Height * DummyPageSetupDlg.kCentiInchToMilliPoints; m_dlg.PaperSizeWidth = paperSize.Width * DummyPageSetupDlg.kCentiInchToMilliPoints; Assert.AreEqual(paperSize.PaperName, m_dlg.PaperSizeName); } } // Now set the dimensions to something that is not in the standard list of paper sizes. // We expect that the selected paper size would be "Custom". m_dlg.PaperSizeHeight = 250 * DummyPageSetupDlg.kCentiInchToMilliPoints; m_dlg.PaperSizeWidth = 250 * DummyPageSetupDlg.kCentiInchToMilliPoints; Assert.AreEqual(ResourceHelper.GetResourceString("kstidPaperSizeCustom"), m_dlg.PaperSizeName); }
public void SelectPaperSizeName() { m_div.NumColumns = 2; m_dlg = new DummyPageSetupDlg(m_pgl, m_pub, m_div, m_pubPageInfo); m_dlg.PageSizeComboIndex = 0; m_dlg.IsAllowNonStandardChecked = true; int lastPaperHeight = 0; int lastPaperWidth = 0; // Iterate through the paper sizes to make sure the appropriate height and width // are displayed on the dialog. Values in PaperSize are stored in hundredths of // inches so we have to convert to millipoints. foreach (string paperSizeName in TestPaperSizes.Keys) { if (paperSizeName != ResourceHelper.GetResourceString("kstidPaperSizeCustom")) { PaperSize paperSize = TestPaperSizes[paperSizeName]; m_dlg.PaperSizeName = paperSize.PaperName; Assert.AreEqual(paperSize.Height * DummyPageSetupDlg.kCentiInchToMilliPoints, m_dlg.PaperSizeHeight, "Height of " + paperSizeName); Assert.AreEqual(paperSize.Width * DummyPageSetupDlg.kCentiInchToMilliPoints, m_dlg.PaperSizeWidth, "Width of " + paperSizeName); lastPaperHeight = m_dlg.PaperSizeHeight; lastPaperWidth = m_dlg.PaperSizeWidth; } } // Now test with "Custom" paper size. We expect that the paper size will be the same // as the last selected paper size. m_dlg.PaperSizeName = ResourceHelper.GetResourceString("kstidPaperSizeCustom"); Assert.AreEqual(lastPaperHeight, m_dlg.PaperSizeHeight, "Custom height"); Assert.AreEqual(lastPaperWidth, m_dlg.PaperSizeWidth, "Custom width"); }
public void HandleZeroPageSize() { m_div.NumColumns = 2; m_pub.PageHeight = m_pub.PageWidth = 0; m_dlg = new DummyPageSetupDlg(wsUser, m_pgl, m_pub, m_div, MsrSysType.Point, m_pubPageInfo); m_dlg.PageSizeComboIndex = 0; // TODO: confirm that the dialog returns the default paper size of the printer // when the page size is set to 0. }
public override void TestTearDown() { if (m_dlg != null) { m_dlg.Dispose(); m_dlg = null; } if (m_pubPageInfo != null) { m_pubPageInfo.Clear(); m_pubPageInfo = null; } base.TestTearDown(); }
public void FollowsStandardSettings() { m_div.NumColumns = 1; m_pub.PageHeight = m_pub.PaperHeight = 11 * 72000; m_pub.PageWidth = m_pub.PaperWidth = (int)(8.5 * 72000); m_pub.BaseFontSize = 10000; m_pub.BaseLineSpacing = -12000; m_dlg = new DummyPageSetupDlg(wsUser, m_pgl, m_pub, m_div, MsrSysType.Point, m_pubPageInfo); m_dlg.AllowNonStandardChoices = false; for (int baseCharSize = 4; baseCharSize < 100; baseCharSize++) { m_dlg.BaseCharSizeControlValue = baseCharSize; Assert.IsTrue(m_dlg.FollowsStandardSettings); } }
public void SelectPaperSizeName_ChangeToNonStandardDimension() { m_div.NumColumns = 2; m_dlg = new DummyPageSetupDlg(wsUser, m_pgl, m_pub, m_div, MsrSysType.Point, m_pubPageInfo); m_dlg.PageSizeComboIndex = 0; m_dlg.IsAllowNonStandardChecked = true; // Set paper size to A4 and confirm that the dialog has A4 settings. m_dlg.PaperSizeName = TestPaperSizes["A4"].PaperName; Assert.AreEqual(TestPaperSizes["A4"].Height * DummyPageSetupDlg.kCentiInchToMilliPoints, m_dlg.PaperSizeHeight); Assert.AreEqual(TestPaperSizes["A4"].Width * DummyPageSetupDlg.kCentiInchToMilliPoints, m_dlg.PaperSizeWidth); // Now change the dimensions of the paper size. The page size combo should be set // to "Custom". m_dlg.PaperSizeHeight *= 2; Assert.AreEqual(ResourceHelper.GetResourceString("kstidPaperSizeCustom"), m_dlg.PaperSizeName); }
public override void Exit() { CheckDisposed(); try { if (m_dlg != null) { m_dlg.Dispose(); m_dlg = null; } if (m_pubPageInfo != null) { m_pubPageInfo.Clear(); m_pubPageInfo = null; } } finally { base.Exit(); } }
public void HandleZeroPageSize() { m_div.NumColumns = 2; m_pub.PageHeight = m_pub.PageWidth = 0; m_dlg = new DummyPageSetupDlg(m_pgl, m_pub, m_div, m_pubPageInfo); m_dlg.PageSizeComboIndex = 0; // TODO: confirm that the dialog returns the default paper size of the printer // when the page size is set to 0. }
public void FollowsStandardSettings() { m_div.NumColumns = 1; m_pub.PageHeight = m_pub.PaperHeight = 11 * 72000; m_pub.PageWidth = m_pub.PaperWidth = (int)(8.5 * 72000); m_pub.BaseFontSize = 10000; m_pub.BaseLineSpacing = -12000; m_dlg = new DummyPageSetupDlg(m_pgl, m_pub, m_div, m_pubPageInfo); m_dlg.AllowNonStandardChoices = false; for (int baseCharSize = 4; baseCharSize < 100; baseCharSize++) { m_dlg.BaseCharSizeControlValue = baseCharSize; Assert.IsTrue(m_dlg.FollowsStandardSettings); } }
public void SelectPaperSizeName_ChangeToNonStandardDimension() { m_div.NumColumns = 2; m_dlg = new DummyPageSetupDlg(m_pgl, m_pub, m_div, m_pubPageInfo); m_dlg.PageSizeComboIndex = 0; m_dlg.IsAllowNonStandardChecked = true; // Set paper size to A4 and confirm that the dialog has A4 settings. m_dlg.PaperSizeName = TestPaperSizes["A4"].PaperName; Assert.AreEqual(TestPaperSizes["A4"].Height * DummyPageSetupDlg.kCentiInchToMilliPoints, m_dlg.PaperSizeHeight); Assert.AreEqual(TestPaperSizes["A4"].Width * DummyPageSetupDlg.kCentiInchToMilliPoints, m_dlg.PaperSizeWidth); // Now change the dimensions of the paper size. The page size combo should be set // to "Custom". m_dlg.PaperSizeHeight *= 2; Assert.AreEqual(ResourceHelper.GetResourceString("kstidPaperSizeCustom"), m_dlg.PaperSizeName); }
public void AdjustPaperSize() { m_div.NumColumns = 2; m_pub.PageWidth = 50000; m_pub.PageHeight = 80000; m_dlg = new DummyPageSetupDlg(m_pgl, m_pub, m_div, m_pubPageInfo); m_dlg.PageSizeComboIndex = 0; m_dlg.IsAllowNonStandardChecked = true; // Iterate through the paper sizes to make sure the appropriate name is selected in // the paper size combo box. We have to convert from 100ths of inches to millipoints. foreach (string paperSizeName in TestPaperSizes.Keys) { if (paperSizeName != ResourceHelper.GetResourceString("kstidPaperSizeCustom")) { PaperSize paperSize = TestPaperSizes[paperSizeName]; m_dlg.PaperSizeHeight = paperSize.Height * DummyPageSetupDlg.kCentiInchToMilliPoints; m_dlg.PaperSizeWidth = paperSize.Width * DummyPageSetupDlg.kCentiInchToMilliPoints; Assert.AreEqual(paperSize.PaperName, m_dlg.PaperSizeName); } } // Now set the dimensions to something that is not in the standard list of paper sizes. // We expect that the selected paper size would be "Custom". m_dlg.PaperSizeHeight = 250 * DummyPageSetupDlg.kCentiInchToMilliPoints; m_dlg.PaperSizeWidth = 250 * DummyPageSetupDlg.kCentiInchToMilliPoints; Assert.AreEqual(ResourceHelper.GetResourceString("kstidPaperSizeCustom"), m_dlg.PaperSizeName); }