@Test
	public void testCursorLocationNewBlock() throws Exception {
		// set bytes per line to 10
		// add block that starts at address 0x30, length of 0x12
		// add a second block that  starts at address 0x48, length of 0x100
		// position the cursor on the first byte on the line for address 0x48
		// verify that the insertion label shows 0x48

		env.showTool();

		ByteViewerOptionsDialog d = launchByteViewerOptions();
		FixedBitSizeValueField field =
			(FixedBitSizeValueField) getInstanceField("bytesPerLineField", d);
		runSwing(() -> field.setValue(BigInteger.valueOf(10)));
		pressButtonByText(d.getComponent(), "OK");

		// add the block
		txSwing(() -> {
			Address addr = getAddr(0x30);
			memory.createInitializedBlock(".test", addr, 0x12, (byte) 0, null, false);

			// add the second block at 0x48
			Address addr2 = getAddr(0x48);
			memory.createInitializedBlock(".test2", addr2, 0x100, (byte) 0, null, false);
		});

		runSwing(() -> {
			ByteViewerComponent c = panel.getCurrentComponent();
			Address a = getAddr(0x48);
			FieldLocation loc = getFieldLocation(a);
			c.setCursorPosition(loc.getIndex(), loc.getFieldNum(), loc.getRow(), loc.getCol());
		});

		Address addr = getAddr(0x48);
		FieldLocation loc = getFieldLocation(addr);
		ByteViewerComponent c = panel.getCurrentComponent();
		// cursor position should not be affected
		assertEquals(loc, c.getCursorLocation());
		assertEquals("00000048", findLabelStr(plugin.getProvider().getComponent(), "Insertion"));
	}
Test editing in the Byte Viewer.
Ghidra/Features/ByteViewer/src/test.slow/java/ghidra/app/plugin/core/byteviewer/ByteViewerPlugin2Test.java